httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Owen Boyle <...@bourse.ch>
Subject Re: Mod_rewrite question
Date Tue, 18 Dec 2001 10:00:38 GMT
Alexander Isaev wrote:
> 
> Hello users,
> 
> How can I solve the following taks?
> 
> I have a site e.g. http://www.my-site.com. It was indexed by Search
> Engines. And  now where a user comes from e.g. http://www.google.com
> I'd like to "rewrite" him to my main page. I use the following
> statement:
> 
> ===
> RewriteEngine On
> 
> RewriteCond %{HTTP_REFERER} ^http://www\.google\.com/  [NC]
> RewriteRule /* http://www.my-site.com [R,L]
> ===
> 
> BUT, when I implement it on my site a weird thing happens. When I
> click on the link to my site from http://www.google.com the browser
> stops responding. After checking my www server log files I've
> noticed the following. The browser requests a page from my site and
> Apache rewrites it to http://www.my-site.com, but HTTP_REFERER still
> contains http://www.google.com and Apache rewrites it again to
> http://www.my-site.com and so on. The only way to stop this process
>  is to press STOP button in my browser.

Having screwed up a bit on a previous poster's problem, let me have a go
at screwing up your's too :-)

Actually, I think I know this one - you have to rewrite the environment
variable to get out of the loop. You do this using the "E" flag - e.g.

RewriteRule /* http://www.my-site.com [R,L,E=HTTP_REFERER:banana]

so on the second pass (after having been rewritten once), the
HTTP_REFERER will have been changed to "banana" and so will not trip the
rule. Double-check the syntax in the docs but I think that's the right
track to be exploring.

Rgds,

Owen Boyle.

---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message