htaccess url重写失败

时间:2013-07-05 13:38:31

标签: php .htaccess

我收到此错误:

 Internal server error. Internal Server Error
 The server encountered an internal error or misconfiguration
 and was unable to complete your request. 

当我跑步时,我可以看到mod_rewrite显示为“已加载的模块”。

这是我的htaccess规则,我想发送任何无法解析/找到的url到index.php

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{REQUEST_FILENAME} !-l
Rewritecond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php [NC,L]

有人可以帮我调试吗?我被卡住了......

3 个答案:

答案 0 :(得分:1)

如果您在WAMP localhost中,则需要配置“httpd.conf”。

答案 1 :(得分:0)

这是我通常做的......

RewriteEngine On
# ignore rules if URL is file
RewriteCond %{REQUEST_FILENAME} !-f
# ignore rules if URL is directory
#RewriteCond %{REQUEST_FILENAME} !-d
# ignore rules if URL is not php
#RewriteCond %{REQUEST_URI} !\.php$

# catch-all for routing
RewriteRule . index.php

答案 2 :(得分:0)

检查日志文件(在vhosts文件或站点可用文件中找到它们)以获取错误。您的.htaccess似乎没问题。