htaccess重写给出LimitInternalRecursion错误

我有一个.htaccess文件与下面的代码

<IfModule mod_rewrite.c> Options -MultiViews RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+)/$ http://%{HTTP_HOST}/$1 [R=301,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] </IfModule> 

但是当我访问我的网站时,我得到这个错误

 [client 127.0.0.1] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace. 

LogLeveldebugging不会给我一个回溯,我不认为增加内部recursion限制是明智的。

有没有人有这种types的错误的经验?

假设请求是/index.html

你的第一个重写条件是:“如果请求的URL不是一个目录,用一个加斜线的redirect来重写它。” 所以URL将被重写为/index.html/ 。 这将再次被重写一个额外的斜杠,等无止境。 这就是为什么你会收到错误信息。

如果未来的人偶然遇到这个…

我有一个类似的问题,我的Laravel 5.1项目在浏览器上发出500个错误,并且Request exceeded the limit of 10 internal redirects due to probable configuration error日志文件中的Request exceeded the limit of 10 internal redirects due to probable configuration errorRequest exceeded the limit of 10 internal redirects due to probable configuration error

我可以通过在我的.htaccess文件中的RewriteEngine On之后添加RewriteBase /来解决这个问题。

希望这可以帮助某人。