【问题标题】:Apache mod_rewrite problemsApache mod_rewrite 问题
【发布时间】:2014-09-20 18:01:13
【问题描述】:

我在 .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

我错过了什么?此配置之前在其他服务器上确实有效。

【问题讨论】:

  • 请附加网络服务器error logrewrite log。您应该始终在问题中包含调试信息,没有它,它更像是在猜测问题。

标签: php apache url mod-rewrite


【解决方案1】:

试试这个...

<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>

【讨论】:

    猜你喜欢
    • 2012-02-16
    • 2015-03-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多