You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Jan Eden <li...@janeden.org> on 2005/05/31 10:00:54 UTC
[users@httpd] Infinite loop with RewriteRule
Hi,
I have a problem with the following RewriteRule causing an infinite loop:
RewriteCond %{HTTP_HOST} (first|second|third|fourth)
RewriteRule ^(.+)$ %1/$1 [L,R,NC]
When requesting a URL like
http://firsthost/something
I end up getting something like
http://firsthost/first/first/first/first/first/first/first/first/first/something
and the server returns an error.
When changing the RewriteRule to this:
RewriteRule ^(.+)$ hardcoded/$1 [L,R,NC]
I get
http://firsthost/hardcoded/hardcoded/hardcoded/hardcoded/hardcoded/hardcoded/hardcoded/hardcoded/hardcoded/hardcoded/hardcoded/hardcoded/hardcoded/hardcoded/hardcoded/hardcoded/something
and the same error message
mod_rewrite: maximum number of internal redirects reached
Why is my pattern ^(.+)$ causing an infinite loop here?
This does not happen if the substitution string does not match the pattern itself, as in
RewriteCond %{HTTP_HOST} (first|second|third|fourth)
RewriteRule ^(something)$ %1/$1 [L,R,NC]
Thanks,
Jan
--
I was gratified to be able to answer promptly, and I did. I said I didn't know. - Mark Twain
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org