Apache mod_rewrite问题

时间:2014-07-29 11:19:14

标签: php apache url mod-rewrite

我在.htaccess中有以下项目。

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php [L,NC,QSA]

我在目录test.txt中有两个文件& test.php

我可以访问/path/to/folder/test.txt但不能访问/path/to/folder/text.php

我错过了什么?此配置之前在其他服务器上运行。

1 个答案:

答案 0 :(得分:0)

试试这个......

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-l
    RewriteRule . /index.php [L,NC,QSA]
</IfModule>