Reputation: 37709
I've got the following in an .htaccess
. file:
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} !^/css(/?|/.+)$
RewriteCond %{REQUEST_URI} !^/js(/?|/.+)$
RewriteCond %{REQUEST_URI} !^/img(/?|/.+)$
RewriteRule !^/handle\.php$ /handle.php [L]
I simply want all requests (except those beginning with /css/
, /js/
, and /img/
) to be sent to handle.php
.
But when I make a request I get a 500 error, and this is printed in the error log:
[Sat Mar 24 16:14:53 2012] [error] [client x.x.x.x] 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.
Why is it getting in an infinite loop?
Upvotes: 1
Views: 1721
Reputation: 1258
It's probably that rewriting a request to /handle.php does not match !^/handle\.php$
, so it tries to rewrite the rewrite, etc. Your issue might be the leading slash? Try playing around with that.
If not, check out the RewriteLog directive (and see the entry just below that, RewriteLogLevel). You'll be able to see what rewrites are being attempted, and you'll likely be able to figure out what's going wrong.
Upvotes: 1