httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Owen Boyle <>
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. It was indexed by Search
> Engines. And  now where a user comes from e.g.
> 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 /* [R,L]
> ===
> BUT, when I implement it on my site a weird thing happens. When I
> click on the link to my site from 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, but HTTP_REFERER still
> contains and Apache rewrites it again to
> 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 /* [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.


Owen Boyle.

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message