httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Isaev <>
Subject Re[2]: Mod_rewrite question
Date Tue, 18 Dec 2001 14:26:28 GMT
Hello Joshua,

Tuesday, Tuesday, December 18, 2001, you wrote:

JS> On Tue, 18 Dec 2001, Alexander Isaev wrote:
>> 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]
>> ===

JS> First let me say that this is a very nasty thing to do.  People are using
JS> google to search for a particular thing, and they found it on a particular
JS> portion of your site.  But you are preventing them from accessing that and
JS> shoving them back to your homepage.  This blows the whole purpose of
JS> search engines.  Google is very aggressive in finding and punishing this
JS> kind of manipulation, so if you do this, you may find your site removed
JS> from google entirely.  Even if they don't, I would be loath to visit a
JS> site that did this to me.

First of all I'm not redirecting to other sites. The visitor stays
on my SITE.

JS> Having said that, the proper technique is

JS> RewriteEngine On
JS> RewriteCond %{HTTP_REFERER} ^http://www\.google\.com/  [NC]
JS> RewriteRule /.+ [R,L]

I've tried this rewrite code. But it doesn't work. There is no LOOP
no, but i'm not redirecting to my main page.

JS> Your rule said "match any URL with zero or more slashes" (which makes no
JS> sense even if it did not create a loop).  My rule says "match any URL with
JS> a slash followed by at least one more character".  So my URL will not
JS> rewrite if the user hits the site homepage, thus preventing the loop you
JS> observed.

JS> Joshua.

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

Best regards,

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