'Apache Error - AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error
I have checked my Apache error log and found the following errors:
[Tue Mar 13 05:04:47.855612 2018] [core:error] [pid 18177] [client xxx.xxx.xxx.xxx] 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.
This is a copy of my .htaccess
file:
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 1 month"
</IfModule>
## EXPIRES CACHING ##
<IfModule mod_headers.c>
<FilesMatch ".(js|css|xml|gz|html)$">
Header append Vary: Accept-Encoding
</FilesMatch>
</IfModule>
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
# END WordPress
Apache 2.4.27
PHP 7.0.27
Can anyone suggest what i need to change?
Solution 1:[1]
Your problem caused by this line :
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
So , get this ?
out between ^([_0-9a-zA-Z-]+/)
and (wp-(content|admin|includes).*)
like this :
RewriteRule ^([_0-9a-zA-Z-]+/)(wp-(content|admin|includes).*) $2 [L]
Because , a?c
will match against ac
as well as a
and at your case if a URI is starting with wp-admin
it will match in two rules , first with this RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
and then with this and that why error happened.
Note: clear browser cache then test it .
Solution 2:[2]
I got this same error, but the cause was different. I had added a bad rewrite rule with add_rewrite_rule()
. After saving the new permalink structure, this line was added to .htaccess
RewriteRule ^ / [QSA,L]
This broke the website and WP wouldn't load in order for me to rebuild the new permalink structure even after commenting out my bad code. I tried using the wp CLI tool wp rewrite flush --hard
, but for that to work, I needed a wp-cli.local.yml
file in my WP project folder (the one with wp-config.php
in it) with the following content:
apache_modules:
- mod_rewrite
I could then do the rewrite flush and get back into my site. Checking the apache2 error log was of no help to me in this case - but YMMV.
Had I known all this, I could have just deleted the offending line from .htaccess
but since I don't really understand RewriteRules file, I didn't know it was at fault.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Mohammed Elhag |
Solution 2 |