2012-10-06 117 views
2

我在我的电脑上使用WAMP,并在编写我的网站时,我决定删除.html扩展名,以期提高美学效果。WAMP - 拖尾斜线(/)给出错误500“内部服务器错误” - .htaccess错误?

这工作正常,所以,在我的情况下,temp.jakegriffin.co.uk/index.html成为/索引,这是我想要的。不幸的是,如果有一个尾随/索引之后,我得到:

Internal Server Error 

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

Please contact the server administrator, [email protected] 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. 

当我尝试在.htaccess文件来解决这个问题,我要么得到错误403是我禁止或错误404人的页面不存在。

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}\.html -f 
RewriteRule ^(.*)$ $1.html 

这是我用于去除扩展的.htaccess文件的代码。如果有人可以帮助我,这将不胜感激。

在此先感谢, 杰克。

+0

什么呢Apache的错误日志说..? –

回答

0

这此的mod_rewrite规则:

* http://planetozh.com/blog/2004/05/apache-and-the-trailing-slash-problem/ 

    RewriteEngine on 
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} -d 
    RewriteRule ^(.+[^/])$ $1/ 
+0

这也没有效果。当没有结尾的斜线时,它只会导致404错误。但是,当没有结尾的斜线时,它会起作用。 – user1725807

+0

好的 - 请试试这个:http://stackoverflow.com/questions/10245542/trailing-slashes-causing-error-code-500 – paulsm4

0

试试这个:

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}\.html -f 
RewriteRule ^(.+)[\/*]$ $1.html [L,NC] 

现在你可以index之后添加了一堆正斜杠(/)的;)

+0

不,没有用。当没有结尾的斜线时,它只会导致404错误。但是,当没有结尾的斜线时,它会起作用。 – user1725807

相关问题