httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrea Rossignoli <apachel...@libero.it>
Subject Re: [users@httpd] In Rewrite Loop -- please help
Date Thu, 11 Sep 2003 19:15:44 GMT
> Your notes on the working configuration were excellent. My original work 
> is based on a novice understanding of mod_rewrite culled from a diverse 
> collection of resources. But "it worked" and trying to fix it proved out 
> common sense, "if it isn't broken, do not fix it." :D I reversed my 
> changes and let the working, less than perfect, configuration stand.
THat's not a problem,
in fact my aim was to show a different way to do that ;)

> I do have some questions on your notes however, if you will indulge me. :)
I'm all ears :)

> 
>> Again you need to add a $ (``end of string''') because
>> ^www\.mycity\.com
>> will match
>> www.mycity.com but www.mycity.com.au , etc too
>> ^www\.mycity\.com$ will only match www.mycity.com
> 
> 
> Regarding the end of string anchor ($), it makes sense, and I avoided 
> using it for I have not seen it used in the examples and documentation I 
> consulted originally 
> (http://httpd.apache.org/docs-2.0/misc/rewriteguide.html#url). Do you 
> think that adding the end of string anchor will effect the RewriteCond 
> dramatically?
> 
Personally I only see benefits of using the $.
I don't think you will have troubles adding it,
maybe you won't have troubles removing it but it's more correct
to add it.
For example com.fr is a valid extension,
don't using the $ will consider mycity.com at the same way as
mycity.com.fr and that's not good.

> In the second virtual host (from the working configuration):
> 
>>
>>> <VirtualHost *>
>>>     ServerName www.mycityevents.com
>>>     ServerAlias mycityevents.com  *.mycityevents.com
>>>     DocumentRoot "C:/usr/local/apache2-01/htdocs/mycity"
>>>     RewriteEngine on
>>>     RewriteCond %{HTTP_HOST} ^www.mycityevents.com [nocase]
>>>     RewriteRule ^/(.*) http://www.mycityevents.com/rec/ [R=permanent]
>>>     RewriteLog logs/rewrite_rec.log
>>>     RewriteLogLevel 9
>>> </VirtualHost>
>>>
>> Nope, I don't think this works.
>> You will create an infinite 30x redirection loop.
>> SO I think you will have to use:
>> #etc
>> RewriteEngine on
>> RewriteCond %{HTTP_HOST} !^www\.mycityevents\.com$ [nocase]
>> RewriteRule ^/(.*) http://www.mycityevents.com/rec/ [R=permanent]
>> #*********WORKING, modified: end
>> I added a ! to avoid the ad-infinitum 30x loop 
> 
> 
> The use of:
> 
> RewriteCond %{HTTP_HOST} ^www.mycityevents.com [nocase]
> 
> is intentional because this actually represents a website that has been 
> folded into content that exists on the domain at www.mycitystate.gov.
> 
> I'm trying to say to the client, "You just asked for 
> 'www.mycityevents.com', but the content is found instead at 
> 'www.mycitystate.gov/rec'." Does this make more sense? Again, as is, the 
> configuration works.
> 
mmm I see, but there you are redirecting to mycityevents.com/rec/
and not to mycityevents.gov/rec/
That's why it sounded me weird, am I right ?
A typo ?

> I'm not afraid of mod_rewrite, but it is a daunting beast.
I agree :D.


Mr Andrea


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