由.htaccess文件引起的WAMP服务器错误

时间:2012-12-10 22:32:00

标签: .htaccess url-rewriting wamp

我正在使用htaccess url的以下rewrite代码,它正在运行。

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
#RewriteBase /

# If the request is for a valid directory
#RewriteCond %{REQUEST_FILENAME} !-d
# If the request is for a valid file
RewriteCond %{REQUEST_FILENAME} -f
# If the request is for a valid link
RewriteCond %{REQUEST_FILENAME} !-l
# do not do anything
RewriteRule ^ - [L]


# forward /john to user/profile.php?name=john
RewriteRule ^(.+)$ user/profile.php?username=$1 [L,QSA,NC]

但是,当我升级到最新的WAMP2服务器时,我开始收到以下错误消息。

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

Please contact the server administrator, admin@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

请有人解释我为什么会收到此错误,以及如何解决此错误。谢谢。

2 个答案:

答案 0 :(得分:0)

mod_rewrite实际上已在服务器配置文件中关闭,我打开它,重新启动服务器,它又开始工作了。

答案 1 :(得分:0)

我遇到了同样的问题,但后来我发现在httpd.conf中mod_rewrite已被哈希表示关闭,所以我删除了行的开头的#并重新启动了所有服务并解决了问题!