htaccess url重写失败


htaccess url rewriting is failing

我收到这个错误:

 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]

有人能帮我调试一下吗?我被卡住了。。。

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

以下是我通常要做的。。。

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

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