You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Alexander Isaev <A....@astelit.ru> on 2001/12/18 08:03:15 UTC

Mod_rewrite question

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.


Thanx in advance.  

Best regards,
 Alexander Isaev                          mailto:A.Isaev@astelit.ru


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


Re[2]: Mod_rewrite question

Posted by Alexander Isaev <A....@astelit.ru>.
Hello Owen,

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

OB> Alexander Isaev wrote:
>> 
>> 
>> OB> RewriteRule /* http://www.my-site.com [R,L,E=HTTP_REFERER:banana]
>> 
>> I just tried it. And .. It didn't work.

OB> Can't imagine why not. Try switching on rewrite logging and look for the
OB> line:

OB> "setting env variable <xxx> to <yyy>"

Here is the part of the log file.

195.96.64.172 - - [18/Dec/2001:17:11:01 +0300] [www.my-site.com/sid#82a7fb4][rid#82fe034/initial] (3) [per-dir /usr/home/wwwuser/www/ppee/] strip per-dir prefix: /usr/home/wwwuser/www/ppee/prev.php -> prev.php
195.96.64.172 - - [18/Dec/2001:17:11:01 +0300] [www.my-site.com/sid#82a7fb4][rid#82fe034/initial] (3) [per-dir /usr/home/wwwuser/www/ppee/] applying pattern '/*' to uri 'prev.php'
195.96.64.172 - - [18/Dec/2001:17:11:01 +0300] [www.my-site.com/sid#82a7fb4][rid#82fe034/initial] (4) RewriteCond: input='http://www.google.com/search?q=movies&btnG=Google+Search' pattern='^http://([a-zA-Z0-9-]*)\.google\.([a-zA-Z0-9-]*)/' => matched
195.96.64.172 - - [18/Dec/2001:17:11:01 +0300] [www.my-site.com/sid#82a7fb4][rid#82fe034/initial] (2) [per-dir /usr/home/wwwuser/www/ppee/] rewrite prev.php -> http://www.my-site.com/
195.96.64.172 - - [18/Dec/2001:17:11:01 +0300] [www.my-site.com/sid#82a7fb4][rid#82fe034/initial] (5) setting env variable 'HTTP_REFERER' to 'banana'
195.96.64.172 - - [18/Dec/2001:17:11:01 +0300] [www.my-site.com/sid#82a7fb4][rid#82fe034/initial] (2) [per-dir /usr/home/wwwuser/www/ppee/] explicitly forcing redirect with http://www.my-site.com/
195.96.64.172 - - [18/Dec/2001:17:11:01 +0300] [www.my-site.com/sid#82a7fb4][rid#82fe034/initial] (1) [per-dir /usr/home/wwwuser/www/ppee/] escaping http://www.my-site.com/ for redirect
195.96.64.172 - - [18/Dec/2001:17:11:01 +0300] [www.my-site.com/sid#82a7fb4][rid#82fe034/initial] (1) [per-dir /usr/home/wwwuser/www/ppee/] redirect to http://www.my-site.com/ [REDIRECT/302]
195.96.64.172 - - [18/Dec/2001:17:11:01 +0300] [www.my-site.com/sid#82a7fb4][rid#82fe034/initial] (3) [per-dir /usr/home/wwwuser/www/ppee/] add path-info postfix: /usr/home/wwwuser/www/ppee -> /usr/home/wwwuser/www/ppee/
195.96.64.172 - - [18/Dec/2001:17:11:01 +0300] [www.my-site.com/sid#82a7fb4][rid#82fe034/initial] (3) [per-dir /usr/home/wwwuser/www/ppee/] strip per-dir prefix: /usr/home/wwwuser/www/ppee/ -> 
195.96.64.172 - - [18/Dec/2001:17:11:01 +0300] [www.my-site.com/sid#82a7fb4][rid#82fe034/initial] (3) [per-dir /usr/home/wwwuser/www/ppee/] applying pattern '/*' to uri ''
195.96.64.172 - - [18/Dec/2001:17:11:01 +0300] [www.my-site.com/sid#82a7fb4][rid#82fe034/initial] (4) RewriteCond: input='http://www.google.com/search?q=movies&btnG=Google+Search' pattern='^http://([a-zA-Z0-9-]*)\.google\.([a-zA-Z0-9-]*)/' => matched
195.96.64.172 - - [18/Dec/2001:17:11:01 +0300] [www.my-site.com/sid#82a7fb4][rid#82fe034/initial] (2) [per-dir /usr/home/wwwuser/www/ppee/] rewrite  -> http://www.my-site.com/

OB> Rgds,

OB> owen Boyle.

OB> ---------------------------------------------------------------------
OB> The official User-To-User support forum of the Apache HTTP Server Project.
OB> See <URL:http://httpd.apache.org/userslist.html> for more info.
OB> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
OB> For additional commands, e-mail: users-help@httpd.apache.org




Best regards,
 Alexander                            mailto:A.Isaev@astelit.ru


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


Re: Mod_rewrite question

Posted by Owen Boyle <ob...@bourse.ch>.
Alexander Isaev wrote:
> 
> 
> OB> RewriteRule /* http://www.my-site.com [R,L,E=HTTP_REFERER:banana]
> 
> I just tried it. And .. It didn't work.

Can't imagine why not. Try switching on rewrite logging and look for the
line:

"setting env variable <xxx> to <yyy>"

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


Re[2]: Mod_rewrite question

Posted by Alexander Isaev <A....@astelit.ru>.
Hello Owen,

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

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

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

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

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

I just tried it. And .. It didn't work.

I've found another way to solve this problem (but I don't like it).

RewriteEngine On

RewriteCond %{HTTP_REFERER} ^http://([a-zA-Z0-9-]*)\.google\.([a-zA-Z0-9-]*)/  [NC]
RewriteRule /* http://www.my-site.com/enter/welcome.htm [R,L]

http://www.my-site.com/enter/welcome.htm is frameset document with
http://www.my-site.com in one frame and another frame is zero height.
Also I've disabled RewriteEngine for
http://www.my-site.com/enter/welcome.htm directory. In this case
rewriting works but sometimes it hangs as I described in my previous
letter.

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

OB> Rgds,

OB> Owen Boyle.

OB> ---------------------------------------------------------------------
OB> The official User-To-User support forum of the Apache HTTP Server Project.
OB> See <URL:http://httpd.apache.org/userslist.html> for more info.
OB> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
OB> For additional commands, e-mail: users-help@httpd.apache.org




Best regards,
 Alexander                            mailto:A.Isaev@astelit.ru


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


Re: Mod_rewrite question

Posted by Owen Boyle <ob...@bourse.ch>.
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


RE: Re[3]: Mod_rewrite question

Posted by Joshua Slive <jo...@slive.ca>.

> From: Alexander Isaev [mailto:A.Isaev@astelit.ru]


> Here is the part of the log file
>

> [www.marikalos.com/sid#82dafb4][rid#830c034/initial] (3) [per-dir
> /usr/home/isaev/www/ppee/] strip per-dir prefix:
> /usr/home/isaev/www/ppee/include/general.css -> include/general.css
> 195.96.64.172 - - [19/Dec/2001:12:06:21 +0300]
> [www.marikalos.com/sid#82dafb4][rid#830c034/initial] (3) [per-dir
> /usr/home/isaev/www/ppee/] applying pattern '/.+' to uri
> 'include/general.css'

Yep, that's what I guessed: you are using this in an .htaccess file or
<directory> section.  Don't.  Put it in the httpd.conf in the main server
context (outside any <directory> section).

Joshua.


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


Re[3]: Mod_rewrite question

Posted by Alexander Isaev <A....@astelit.ru>.
Hello Joshua,

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



JS> I am almost sure that this rule is correct.  Check again, and post the
JS> rewritelog if you can't figure it out.

Here is the part of the log file

195.96.64.172 - - [19/Dec/2001:12:06:21 +0300] [www.marikalos.com/sid#82dafb4][rid#830c034/initial] (1) [per-dir /usr/home/isaev/www/ppee/] pass through /usr/home/isaev/www/ppee/prev.php
195.96.64.172 - - [19/Dec/2001:12:06:21 +0300] [www.marikalos.com/sid#82dafb4][rid#830c034/initial] (3) [per-dir /usr/home/isaev/www/ppee/] strip per-dir prefix: /usr/home/isaev/www/ppee/include/general.css -> include/general.css
195.96.64.172 - - [19/Dec/2001:12:06:21 +0300] [www.marikalos.com/sid#82dafb4][rid#830c034/initial] (3) [per-dir /usr/home/isaev/www/ppee/] applying pattern '/.+' to uri 'include/general.css'
195.96.64.172 - - [19/Dec/2001:12:06:21 +0300] [www.marikalos.com/sid#82dafb4][rid#830c034/initial] (4) RewriteCond: input='http://www.marikalos.com/prev.php' pattern='^http://www\.google\.com/' => not-matched
195.96.64.172 - - [19/Dec/2001:12:06:21 +0300] [www.marikalos.com/sid#82dafb4][rid#830c034/initial] (1) [per-dir /usr/home/isaev/www/ppee/] pass through /usr/home/isaev/www/ppee/include/general.css
195.96.64.172 - - [19/Dec/2001:12:06:21 +0300] [www.marikalos.com/sid#82dafb4][rid#830c034/initial] (3) [per-dir /usr/home/isaev/www/ppee/site/] strip per-dir prefix: /usr/home/isaev/www/ppee/site/gals/thumb/bustypee.jpg -> gals/thumb/bustypee.jpg
195.96.64.172 - - [19/Dec/2001:12:06:21 +0300] [www.marikalos.com/sid#82dafb4][rid#830c034/initial] (3) [per-dir /usr/home/isaev/www/ppee/site/] applying pattern '/*' to uri 'gals/thumb/bustypee.jpg'
195.96.64.172 - - [19/Dec/2001:12:06:21 +0300] [www.marikalos.com/sid#82dafb4][rid#830c034/initial] (4) RewriteCond: input='http://www.marikalos.com/prev.php' pattern='!^http://www.marikalos.com/' => not-matched
195.96.64.172 - - [19/Dec/2001:12:06:21 +0300] [www.marikalos.com/sid#82dafb4][rid#830c034/initial] (1) [per-dir /usr/home/isaev/www/ppee/site/] pass through /usr/home/isaev/www/ppee/site/gals/thumb/bustypee.jpg
195.96.64.172 - - [19/Dec/2001:12:06:21 +0300] [www.marikalos.com/sid#82dafb4][rid#830c034/initial] (3) [per-dir /usr/home/isaev/www/ppee/site/] strip per-dir prefix: /usr/home/isaev/www/ppee/site/movies/images/marikalos27p.jpg -> movies/images/marikalos27p.jpg
195.96.64.172 - - [19/Dec/2001:12:06:21 +0300] [www.marikalos.com/sid#82dafb4][rid#830c034/initial] (3) [per-dir /usr/home/isaev/www/ppee/site/] applying pattern '/*' to uri 'movies/images/marikalos27p.jpg'
195.96.64.172 - - [19/Dec/2001:12:06:21 +0300] [www.marikalos.com/sid#82dafb4][rid#830c034/initial] (4) RewriteCond: input='http://www.marikalos.com/prev.php' pattern='!^http://www.marikalos.com/' => not-matched
195.96.64.172 - - [19/Dec/2001:12:06:21 +0300] [www.marikalos.com/sid#82dafb4][rid#830c034/initial] (1) [per-dir /usr/home/isaev/www/ppee/site/] pass through /usr/home/isaev/www/ppee/site/movies/images/marikalos27p.jpg
195.96.64.172 - - [19/Dec/2001:12:06:21 +0300] [www.marikalos.com/sid#82dafb4][rid#830c034/initial] (3) [per-dir /usr/home/isaev/www/ppee/site/] strip per-dir prefix: /usr/home/isaev/www/ppee/site/movies/images/mfstreetpeep.jpg -> movies/images/mfstreetpeep.jpg
195.96.64.172 - - [19/Dec/2001:12:06:21 +0300] [www.marikalos.com/sid#82dafb4][rid#830c034/initial] (3) [per-dir /usr/home/isaev/www/ppee/site/] applying pattern '/*' to uri 'movies/images/mfstreetpeep.jpg'
195.96.64.172 - - [19/Dec/2001:12:06:21 +0300] [www.marikalos.com/sid#82dafb4][rid#830c034/initial] (4) RewriteCond: input='http://www.marikalos.com/prev.php' pattern='!^http://www.marikalos.com/' => not-matched
195.96.64.172 - - [19/Dec/2001:12:06:21 +0300] [www.marikalos.com/sid#82dafb4][rid#830c034/initial] (1) [per-dir /usr/home/isaev/www/ppee/site/] pass through /usr/home/isaev/www/ppee/site/movies/images/mfstreetpeep.jpg
195.96.64.172 - - [19/Dec/2001:12:06:21 +0300] [www.marikalos.com/sid#82dafb4][rid#830c034/initial] (3) [per-dir /usr/home/isaev/www/ppee/site/] strip per-dir prefix: /usr/home/isaev/www/ppee/site/movies/images/marikalos26p.jpg -> movies/images/marikalos26p.jpg
195.96.64.172 - - [19/Dec/2001:12:06:21 +0300] [www.marikalos.com/sid#82dafb4][rid#830c034/initial] (3) [per-dir /usr/home/isaev/www/ppee/site/] applying pattern '/*' to uri 'movies/images/marikalos26p.jpg'
195.96.64.172 - - [19/Dec/2001:12:06:21 +0300] [www.marikalos.com/sid#82dafb4][rid#830c034/initial] (4) RewriteCond: input='http://www.marikalos.com/prev.php' pattern='!^http://www.marikalos.com/' => not-matched
195.96.64.172 - - [19/Dec/2001:12:06:21 +0300] [www.marikalos.com/sid#82dafb4][rid#830c034/initial] (1) [per-dir /usr/home/isaev/www/ppee/site/] pass through /usr/home/isaev/www/ppee/site/movies/images/marikalos26p.jpg
195.96.64.172 - - [19/Dec/2001:12:06:21 +0300] [www.marikalos.com/sid#82dafb4][rid#830c034/initial] (3) [per-dir /usr/home/isaev/www/ppee/site/] strip per-dir prefix: /usr/home/isaev/www/ppee/site/movies/images/marikalos25p.jpg -> movies/images/marikalos25p.jpg
195.96.64.172 - - [19/Dec/2001:12:06:21 +0300] [www.marikalos.com/sid#82dafb4][rid#830c034/initial] (3) [per-dir /usr/home/isaev/www/ppee/site/] applying pattern '/*' to uri 'movies/images/marikalos25p.jpg'
195.96.64.172 - - [19/Dec/2001:12:06:21 +0300] [www.marikalos.com/sid#82dafb4][rid#830c034/initial] (4) RewriteCond: input='http://www.marikalos.com/prev.php' pattern='!^http://www.marikalos.com/' => not-matched
195.96.64.172 - - [19/Dec/2001:12:06:21 +0300] [www.marikalos.com/sid#82dafb4][rid#830c034/initial] (1) [per-dir /usr/home/isaev/www/ppee/site/] pass through /usr/home/isaev/www/ppee/site/movies/images/marikalos25p.jpg
195.96.64.172 - - [19/Dec/2001:12:06:21 +0300] [www.marikalos.com/sid#82dafb4][rid#830c034/initial] (3) [per-dir /usr/home/isaev/www/ppee/site/] strip per-dir prefix: /usr/home/isaev/www/ppee/site/movies/images/marikalos24p.jpg -> movies/images/marikalos24p.jpg
195.96.64.172 - - [19/Dec/2001:12:06:21 +0300] [www.marikalos.com/sid#82dafb4][rid#830c034/initial] (3) [per-dir /usr/home/isaev/www/ppee/site/] applying pattern '/*' to uri 'movies/images/marikalos24p.jpg'
195.96.64.172 - - [19/Dec/2001:12:06:21 +0300] [www.marikalos.com/sid#82dafb4][rid#830c034/initial] (4) RewriteCond: input='http://www.marikalos.com/prev.php' pattern='!^http://www.marikalos.com/' => not-matched
195.96.64.172 - - [19/Dec/2001:12:06:21 +0300] [www.marikalos.com/sid#82dafb4][rid#830c034/initial] (1) [per-dir /usr/home/isaev/www/ppee/site/] pass through /usr/home/isaev/www/ppee/site/movies/images/marikalos24p.jpg

JS> Joshua.


JS> ---------------------------------------------------------------------
JS> The official User-To-User support forum of the Apache HTTP Server Project.
JS> See <URL:http://httpd.apache.org/userslist.html> for more info.
JS> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
JS> For additional commands, e-mail: users-help@httpd.apache.org




Best regards,
 Alexander                            mailto:A.Isaev@astelit.ru


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


Re[2]: Mod_rewrite question

Posted by Joshua Slive <jo...@slive.ca>.
On Tue, 18 Dec 2001, Alexander Isaev wrote:
> First of all I'm not redirecting to other sites. The visitor stays
> on my SITE.

That is irrelevant.  You are still sending them to a different page than
the one they are looking for.

>
> JS> Having said that, the proper technique is
>
> JS> RewriteEngine On
> JS> RewriteCond %{HTTP_REFERER} ^http://www\.google\.com/  [NC]
> JS> RewriteRule /.+ http://www.my-site.com [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.

I am almost sure that this rule is correct.  Check again, and post the
rewritelog if you can't figure it out.

Joshua.


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


Re[2]: Mod_rewrite question

Posted by Alexander Isaev <A....@astelit.ru>.
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. 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]
>> ===
>>

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 /.+ http://www.my-site.com [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:http://httpd.apache.org/userslist.html> for more info.
JS> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
JS> For additional commands, e-mail: users-help@httpd.apache.org




Best regards,
 Alexander                            mailto:A.Isaev@astelit.ru


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


Re: Mod_rewrite question

Posted by Joshua Slive <jo...@slive.ca>.
On 18 Dec 2001, Billy Harvey wrote:

> On Tue, 2001-12-18 at 09:11, Joshua Slive wrote:
> > First let me say that this is a very nasty thing to do.  People are using
> > google to search for a particular thing, and they found it on a particular
> > portion of your site.  But you are preventing them from accessing that and
> > shoving them back to your homepage.  This blows the whole purpose of
> > search engines.  Google is very aggressive in finding and punishing this
> > kind of manipulation, so if you do this, you may find your site removed
> > from google entirely.  Even if they don't, I would be loath to visit a
> > site that did this to me.
>
> There are many valid reasons to require a visitor to begin his
> navigation via your front page.  The fact that google indexed my site
> some time ago - an amount of time that *I* as the most knowledgeable
> about the specifics of my site *don't control* - is sufficient alone for
> me as the site designer/maintainer to decide if I want to force everyone
> to enter via the front page.  It is my site - *I* decide on the control
> - not google.  If the visitor doesn't like my control, he's welcome to
> go elsewhere.

I guess we may be drifting off-topic here, but let me make this clear.
You have every right to do whatever you want on your site, but when you
let a search engine index one thing, but then deliberately feed a user
something else, I consider that rude at the least.  Good sites are not
this inconsiderate to their users.

If the user is looking for the "mercury sable coup", and you let a very
specific page about that car get in the index, but then when they try to
access it, you give them the "ford" homepage, you are making life more
difficult for the browser and reducing the value of the search engine and
the web in general.  If it happens that the "mercury sable coup" page has
moved to a different location, then you should redirect to the most
appropriate new page, not the site homepage.

I don't know how google deals with this particular issue, but I know they
are very strict about banning sites that present one view to a search
engine and a different view to real users.  This is a boarderline case,
and I'm not sure what their policy is.

Joshua.


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


Re: Mod_rewrite question

Posted by Billy Harvey <Bi...@thrillseeker.net>.
On Tue, 2001-12-18 at 09:11, Joshua Slive wrote:
> On Tue, 18 Dec 2001, Alexander Isaev wrote:
> >
> > 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:

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

There are many valid reasons to require a visitor to begin his
navigation via your front page.  The fact that google indexed my site
some time ago - an amount of time that *I* as the most knowledgeable
about the specifics of my site *don't control* - is sufficient alone for
me as the site designer/maintainer to decide if I want to force everyone
to enter via the front page.  It is my site - *I* decide on the control
- not google.  If the visitor doesn't like my control, he's welcome to
go elsewhere.

I solve this problem, on those sites where needed, by using a session
that times out at a period I specify.  Since cookies are an on again/off
again affair for who enables them, etc., I've quit using them for the
most part and generate a unique identifier that is attached to the url
after visiting the home page.  Subsequent pages check to see if that
identifier is still valid, and if not redirect my visitor to the home
page.  This way a bookmark that's more than a specified time old will
still "work" but in the way I control.

I've also not seen anything about google considering this manipulation,
nor would I care if they do.  They're a search engine - not a
self-elected decider of "the right way" to visit my site.  That's for me
to decide.

Billy


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


Re: Mod_rewrite question

Posted by Joshua Slive <jo...@slive.ca>.
On Tue, 18 Dec 2001, Alexander Isaev wrote:
> 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]
> ===
>

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

Having said that, the proper technique is

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

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

Joshua.


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