Forum Moderators: phranque

Message Too Old, No Replies

Blocking search engines

         

Eddie1506

4:20 am on Jan 17, 2006 (gmt 0)

10+ Year Member



Basicly, I want to block search engines from ever finding my site so i'm using the following mod_rewrite rules.

RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} Googlebot [OR]
RewriteCond %{HTTP_USER_AGENT} AltaVista [OR]
RewriteCond %{HTTP_USER_AGENT} Lycos [OR]
RewriteCond %{HTTP_USER_AGENT} Slurp [OR]
RewriteCond %{HTTP_USER_AGENT} Scooter [OR]
RewriteCond %{HTTP_USER_AGENT} YahooSeeker [OR]
RewriteCond %{HTTP_USER_AGENT} msnbot [OR]
.
.
.
.
RewriteRule ^.*$ [google.com...] [R,L]

Now, problem is that when I use my browser to reach my site, I also get redirected to Google.

why?

jdMorgan

3:37 pm on Jan 17, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The problem is likely to be in the code you didn't post -- namely, the final RewriteCond. Make sure there is no [OR] flag on the last RewriteCond before the RewriteRule.

Also, I'd recommend the following rule change to accomplish your stated goal:


RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} Googlebot [OR]
...
RewriteCond %{HTTP_USER_AGENT} msnbot [OR]
RewriteCond %{HTTP_USER_AGENT} zzbot
[b]RewriteRule .* - [F][/b]

The modifed rule returns a 403-Forbidden response, rather than trying to do a 302 redirect. In light of recent problems, a 302 might be taken as a URL hijacking attempt, and I recommend against using it for your purpose.

Jim

Eddie1506

7:12 pm on Jan 17, 2006 (gmt 0)

10+ Year Member



Thanks for the hints. It seems to be working :)

bhartzer

7:17 pm on Jan 17, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I want to block search engines from ever finding my site

Chances are they already found it. What I think you mean is that you want to make sure they don't index it. If that's the case, then:

- password protect the site
- use the Google removal tool to remove the site

Stuff does happen, so to completely protect it you need to password protect it.