RE: [users@httpd] Infinite loop with RewriteRule

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

 



> -----Original Message-----
> From: Jan Eden [mailto:lists@xxxxxxxxxxx]
> Sent: Dienstag, 31. Mai 2005 10:01
> To: users@xxxxxxxxxxxxxxxx
> Subject: [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]

You do understand what ^(.+)$ converts to? It means: "from the start, 1 or more of any character (greedy), to the end"

That is, it will match the entire URI, no matter what it is. 

Rather than asking for a theoretical explanation of why your pattern doesn't work, why not describe what you're trying to achieve and explain why you think you need this pattern. Eg,

- what is the input URL?
- what do you want the output to look like?

Rgds,
Owen Boyle
Disclaimer: Any disclaimer attached to this message may be ignored. 

> 
> When requesting a URL like
> 
> http://firsthost/something
> 
> I end up getting something like
> 
> http://firsthost/first/first/first/first/first/first/first/fir
> st/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/hardc
oded/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

Diese E-mail ist eine private und persönliche Kommunikation. Sie hat keinen Bezug zur Börsen- bzw. Geschäftstätigkeit der SWX Gruppe. This e-mail is of a private and personal nature. It is not related to the exchange or business activities of the SWX Group. Le présent e-mail est un message privé et personnel, sans rapport avec l'activité boursière du Groupe SWX.
 
 
This message is for the named person's use only. It may contain confidential, proprietary or legally privileged information. No confidentiality or privilege is waived or lost by any mistransmission. If you receive this message in error, please notify the sender urgently and then immediately delete the message and any copies of it from your system. Please also immediately destroy any hardcopies of the message. You must not, directly or indirectly, use, disclose, distribute, print, or copy any part of this message if you are not the intended recipient. The sender's company reserves the right to monitor all e-mail communications through their networks. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorised to state them to be the views of the sender's company.

---------------------------------------------------------------------
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