Block bad bots in .htaccess file in cPanel / WordPress / Apache

Add below code in .htaccess file
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} ^.*(adscanner|AhrefsBot|archive.org_bot|Baiduspider|BehloolBot|bingbot|BLEXBot|coccocbot-image|coccocbot-web|compatible|contxbot|DotBot|DuckDuckGo-Favicons-Bot|DuckDuckBot|Exabot|facebot|facebookexternalhit|Slurp|GrapeshotCrawler|houzzbot|MJ12bot|MojeekBot|Nimbostratus-Bot|PaperLiBot|PlurkBot|Seekport|SemrushBot|SEOkicks|SeznamBot|stagefright|SurdotlyBot|Sogou|TinEye-bot|YaK|YandexBot|YandexImages).*$ [NC]
RewriteRule .* - [F,L]

List of Bots which you have just blocked
adscanner
AhrefsBot
archive.org_bot
Baiduspider
BehloolBot
bingbot
BLEXBot
coccocbot-image
coccocbot-web
contxbot
DotBot
DuckDuckGo-Favicons-Bot
DuckDuckBot
Exabot
Slurp
GrapeshotCrawler
houzzbot
MJ12bot
MojeekBot
Nimbostratus-Bot
PaperLiBot
PlurkBot
Seekport
SemrushBot
SEOkicks
SeznamBot
stagefright
SurdotlyBot
Sogou
TinEye-bot
YandexBot
YandexImages
Exabot
istellabot

2 Replies to “Block bad bots in .htaccess file in cPanel / WordPress / Apache”

Leave a Reply

%d bloggers like this: