WordPress Network Default Rewrite Rules Causing 500 Errors
-
We are seeing some server errors (500) in our logs related to rewrites for non-existent files referencing wp-content, wp-includes, or wp-admin in the path.
For example, loading up following: https://example.com/wp-admin/test/test.jpg will generate the error. You would expect a 404 to be generated, but it’s actually a 500. The specific error in the error log is:
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.
Whereas the following location will generate a 404: https://example.com/wp-blah/te
Googling the issue, it seems like the default rewrite rules provided with a WordPress network install don’t handle this situation. Specifically, these rules:
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
A fix suggested by this post replaces the above with the following:
RewriteRule ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L] RewriteRule ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
These do fix the 500 issue. Not sure at this point if I’m going to break something else. Everything I’ve tried is working properly thus far with the new rules.
- The topic ‘WordPress Network Default Rewrite Rules Causing 500 Errors’ is closed to new replies.