[users@httpd] Infinite loop with RewriteRule

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux