#block bad bots with a 403
SetEnvIfNoCase User-Agent "AhrefsBot" bad_bot
SetEnvIfNoCase User-Agent "Baiduspider" bad_bot
SetEnvIfNoCase User-Agent "BBot" bad_bot" bad_bot
SetEnvIfNoCase User-Agent "BLEXBot" bad_bot
SetEnvIfNoCase User-Agent "Custo" bad_bot
SetEnvIfNoCase User-Agent "CFNetwork" bad_bot
SetEnvIfNoCase User-Agent "CMS Crawler" bad_bot
SetEnvIfNoCase User-Agent "CsCrawler" bad_bot
SetEnvIfNoCase User-Agent "DomainAppender" bad_bot
SetEnvIfNoCase User-Agent "Grapeshot Crawler" bad_bot
SetEnvIfNoCase User-Agent "Jakarta commons-httpclient" bad_bot
SetEnvIfNoCase User-Agent "Lipperhey SEO Service" bad_bot
SetEnvIfNoCase User-Agent "Linkdex" bad_bot
SetEnvIfNoCase User-Agent "MegaIndex.ru" bad_bot
SetEnvIfNoCase User-Agent "MJ12bot" bad_bot
SetEnvIfNoCase User-Agent "ning" bad_bot
SetEnvIfNoCase User-Agent "Python-urllib" bad_bot
SetEnvIfNoCase User-Agent "Phantom" bad_bot
SetEnvIfNoCase User-Agent "Perl tool" bad_bot
SetEnvIfNoCase User-Agent "pegasus" bad_bot
SetEnvIfNoCase User-Agent "spbot" bad_bot
SetEnvIfNoCase User-Agent "SEOprofiler Bot" bad_bot
SetEnvIfNoCase User-Agent "SMTBot" bad_bot
SetEnvIfNoCase User-Agent "SurveyBot" bad_bot
SetEnvIfNoCase User-Agent "SISTRIX Crawler" bad_bot
SetEnvIfNoCase User-Agent "Sogou Spider" bad_bot
SetEnvIfNoCase User-Agent "Verisign" bad_bot
SetEnvIfNoCase User-Agent "WebFilter" bad_bot
SetEnvIfNoCase User-Agent "Web Core / Roots" bad_bot
SetEnvIfNoCase User-Agent "WebMeUp backlink tool" bad_bot
SetEnvIfNoCase User-Agent "WGet tools" bad_bot
SetEnvIfNoCase User-Agent "Mb2345Browser" bad_bot
SetEnvIfNoCase User-Agent "LieBaoFast" bad_bot
SetEnvIfNoCase User-Agent "zh-CN" bad_bot
SetEnvIfNoCase User-Agent "MicroMessenger" bad_bot
SetEnvIfNoCase User-Agent "zh_CN" bad_bot
SetEnvIfNoCase User-Agent "Kinza" bad_bot
<Limit GET POST HEAD>
Order Allow,Deny
Allow from all
Deny from env=bad_bot
</Limit>
RewriteCond %{HTTP_USER_AGENT} ^.*Baidu.*$ [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*MJ12bot.*$ [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*SEOprofiler.*$ [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*Ahrefs.*$[NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*Sogou.*$ [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*BBot.*$ [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*Python-urllib.*$ [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*SurveyBot.*$ [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*Perl.?tool [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*Jakarta.*$ [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*Grapeshot.*$ [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*Custo.*$ [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*Verisign.*$ [NC,OR]
RewriteRule ^(.*)$ http://127.0.0.1 [R,L]
RewriteCond %{HTTP_REFERER} ^http://.*majestic12\.co\.uk/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://.*ahrefs\.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://.*openlinkprofiler\.org/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^https://.*ahrefs\.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://.*sogou\.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://.*netwu\.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://.*grapeshot\.co\.uk/ [NC]
RewriteRule ^(.*)$ http://127.0.0.1 [R,L]