Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/258.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Htaccess中无效文件扩展名的Htaccess rewrite权限_Php_.htaccess_Mod Rewrite_Redirect_Url Redirection - Fatal编程技术网

Php Htaccess中无效文件扩展名的Htaccess rewrite权限

Php Htaccess中无效文件扩展名的Htaccess rewrite权限,php,.htaccess,mod-rewrite,redirect,url-redirection,Php,.htaccess,Mod Rewrite,Redirect,Url Redirection,我不知道这个老问题,我用谷歌搜索了一个小时,但我找不到解决办法 在htaccess中,当文件无效时,我们可以重定向404(设计的,不是默认的) 例如: https://www.example.com/tedgfsst.php https://www.example.com/tedgfsst.eg 如果输入的文件扩展名无效,则需要重定向404页 例如: https://www.example.com/tedgfsst.php https://www.example.com/tedgfsst.

我不知道这个老问题,我用谷歌搜索了一个小时,但我找不到解决办法

在htaccess中,当文件无效时,我们可以重定向404(设计的,不是默认的)

例如:

https://www.example.com/tedgfsst.php
https://www.example.com/tedgfsst.eg
如果输入的文件扩展名无效,则需要重定向404页

例如:

https://www.example.com/tedgfsst.php
https://www.example.com/tedgfsst.eg


最后,我得到了重写无效文件扩展名重定向到404错误页面的答案

RewriteCond %{REQUEST_URI} /|(/[^.]*|[a-z]|[0-9]\.(php|html?|feed|pdf|vcf|raw))$ [NC]

你有htaccess指令吗?