JayIsTooCommon
JayIsTooCommon

Reputation: 1714

Request exceeded the limit of 10 internal redirects - .htaccess

I am receiving the below error message in my Apache log after cloning the git repo on our dev server;

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.

2x .htaccess copied below;

Webroot .htaccess (located in projectRoot/webroot/)

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /apply/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

Application .htaccess (located in projectRoot/)

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteBase /apply/
    RewriteRule    ^$    webroot/    [L]
    RewriteRule    (.*) webroot/$1    [L]
</IfModule>

Other answers say to change RewriteBase to /, but this isn't an option for me as I need it to be /apply/. A few other answers pointed to the RewriteRule being the issue, however removing these doesn't solve the issue.

Upvotes: 4

Views: 1345

Answers (1)

Amit Verma
Amit Verma

Reputation: 41249

You need to exclude the destination you are rewriting to :

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteBase /apply/
    RewriteRule ^$ webroot/ [L]
    RewriteCond %{REQUEST_URI} !^/webroot/
    RewriteRule    (.*) webroot/$1    [L]
</IfModule>

Otherwise you will get a rewrite loop error, because /webroot/ also matches the pattern (.*)

Upvotes: 2

Related Questions