Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/468.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
Mod rewrite 请求文件名存在Mod重写问题_Mod Rewrite_Url Rewriting_Url Routing - Fatal编程技术网

Mod rewrite 请求文件名存在Mod重写问题

Mod rewrite 请求文件名存在Mod重写问题,mod-rewrite,url-rewriting,url-routing,Mod Rewrite,Url Rewriting,Url Routing,我在服务器将domain.com/index解释为domain.com/index.php时遇到问题。这与我的URL结构有关 我已使用以下内容创建了一个.htaccess文件: <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?url=$1 [PT

我在服务器将domain.com/index解释为domain.com/index.php时遇到问题。这与我的URL结构有关

我已使用以下内容创建了一个.htaccess文件:

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php?url=$1 [PT,L]

</IfModule>

重新启动发动机
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$index.php?url=$1[PT,L]
因此,如果我键入URL domain.com/index/about,我想从
$获取index/about\u get['URL']
。但是它是空白的。如果我键入任何其他不以索引开头的URL,如domain.com/foo/bar,我会得到预期的结果

我知道这是由于
RewriteCond%{REQUEST\u FILENAME}-f
,如果存在具有相同文件名的文件,则忽略任何重写

所以,只要URL不涉及单词索引或其他目录或文件名,我的重写规则就会给出我想要的结果。这很好,因为我在当前目录中没有其他目录或文件

问题就是这样我可以更具体一些,比如说忽略filename.php而不仅仅是filename吗?这意味着domain.com/index/about应该可以工作,但domain.com/index.php/about不能工作

附带问题:为什么domain.com/index/about不起作用?我没有名为index/about的目录,也没有名为index/about的文件。为什么它将index/something解释为index.php/something,这毫无意义,因为我不能在文件中使用dir