Home » Useful » Blocking bots via .htaccess file

Blocking bots via .htaccess file

Needed to do that the other day as the server load has spiked to 80+

RewriteEngine On
RewriteBase /
SetEnvIfNoCase User-Agent 'bingbot/2.0' bad_agent
Deny from env=bad_agent


SetEnvIfNoCase User-Agent '$BOTNAME' bad_agent

before the “Deny” line for every bot you want to block

Posted in Useful and tagged as , , , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.