httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Eden <li...@janeden.org>
Subject [users@httpd] Infinite loop with RewriteRule
Date Tue, 31 May 2005 08:00:54 GMT
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


Mime
View raw message