Mobile app version of vmapp.org
Login or Join
Margaret670

: Am I doing .htaccess right to block google, bing and alexa bots? I do not need bots at all. I bought my traffic and I do not want my sites to show up on search engine or anything. So

@Margaret670

Posted in: #Botattack #Googlebot #RobotsTxt

I do not need bots at all. I bought my traffic and I do not want my sites to show up on search engine or anything.

So I added this:

<IfModule mod_setenvif.c>
# remove most popular bot
SetEnvIfNoCase User-Agent ".*alexa.*" bad_bot
SetEnvIfNoCase User-Agent ".*google.*" bad_bot
SetEnvIfNoCase User-Agent ".*bing.*" bad_bot


Am I doing it right?

Basically any user agent containing alexa google or bing will not pass

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Margaret670

1 Comments

Sorted by latest first Latest Oldest Best

 

@Annie201

I may be somewhat overboard with my regex part, but these lines in your apache configuration will block them. Basically it scans the entire user agent identification string to see if it contains "googlebot", "bingbot" or "alexa" and if it does then direct users to the default error 403 page

RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} ^(.*)googlebot(.*)$ [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^(.*)bingbot(.*)$ [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^(.*)alexa(.*)$ [NC]
RewriteRule .* - [F,L]


And if you want to set a custom error 403 page, use this line:

ErrorDocument 403 /path/to/errordocument.htm

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme