Ffile2fix
Sign in Get started

How to fix Apache AH00124: exceeded the limit of 10 internal redirects

AH00124: 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.

A rewrite rule is rewriting a URL internally, the result matches the rule again, and Apache gave up after 10 passes and returned a 500 error. This is an internal loop inside the server, unlike a browser redirect loop.

Also appears as: [core:error] [pid 1234] [client 203.0.113.5:443] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. · Request exceeded the limit of 10 subrequest nesting levels due to probable configuration error. · 500 Internal Server Error with AH00124 in the Apache error log

Common causes

  • A front-controller rule like RewriteRule ^(.*)$ index.php/$1 without RewriteCond checks, so index.php itself is rewritten again
  • Wrong RewriteBase after moving a site into or out of a subfolder
  • Rewriting to a file that does not exist, which triggers the rule again
  • Rules in both a parent and a subfolder .htaccess that rewrite to each other
  • Laravel or other apps installed with the project root as document root, so public/ rewrites chain
  • ErrorDocument pointing to a URL that itself gets rewritten in a loop

How to fix it

  1. Find the rule that loops. On a VPS set LogLevel alert rewrite:trace3 temporarily and read the error log to see each rewrite pass. On shared hosting, comment out rules one by one.
  2. Exclude real files and folders. Add RewriteCond %{REQUEST_FILENAME} !-f and RewriteCond %{REQUEST_FILENAME} !-d before the front-controller rule so existing files, including index.php, stop the chain.
  3. Stop rewriting the target. Add an early rule such as RewriteRule ^index\.php$ - [L], or use the [END] flag on the final rule so it does not run again.
  4. Correct RewriteBase. If the site is in a subfolder, set RewriteBase /subfolder/ and make the target relative (index.php), or the rewritten path will not exist.
  5. Point the document root to public/. For Laravel and Symfony, set the domain's document root to public/ instead of chaining root and public .htaccess files.
  6. Do not just raise LimitInternalRecursion. Raising the limit only delays the 500. Fix the rule so the loop ends.

.htaccess (front controller without a loop)

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [END]

How to stop it happening again

  • Always guard catch-all rules with !-f and !-d conditions
  • Update RewriteBase whenever you move an app between folders
  • Test rewrite changes on staging with trace logging enabled

Frequently asked questions

How is AH00124 different from ERR_TOO_MANY_REDIRECTS?

AH00124 is an internal rewrite loop inside Apache and shows as a 500 error. ERR_TOO_MANY_REDIRECTS is an external loop of 301/302 responses that the browser follows.

What does the [END] flag do?

[END] stops all rewrite processing, including the extra pass Apache makes in .htaccess context after an internal rewrite. [L] only ends the current pass, so the rules can run again.

Why did this start after moving to a subfolder?

Rules written for the domain root rewrite to /index.php, which does not exist in the new location, so Apache keeps rewriting. Update RewriteBase and paths.