httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Eden <>
Subject [users@httpd] Infinite loop with RewriteRule
Date Tue, 31 May 2005 08:00:54 GMT

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


I end up getting something like


and the server returns an error.

When changing the RewriteRule to this:

RewriteRule ^(.+)$ hardcoded/$1 [L,R,NC]

I get


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]


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:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message