I have a .htaccess file with the following code
<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>
But when I visit my site I get this error
[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.
The LogLevel debug doesn't give me a backtrace and I don't think increasing the Limit on internal recursion is wise.
Does anyone have experience with this type of error?
Best Answer
Assume that the request is for
/index.html
.Your first rewrite condition says "if the URL requested is not a directory, rewrite it with a redirect to itself with an added slash." So the URL will be rewritten with a redirect to
/index.html/
. Which will again be rewritten with an added slash, etc ad infinitum. This is why you get the error message.