How to Block Bad Bots and Spiders using .htaccess

Mon Oct 03 2022 By, Hennadiy T.

How to Block Bad Bots and Spiders using .htaccess

Is your site suffering from spam comments, content scrapers stealing content, bandwidth leeches, and other bad bots?
In this Knowledge Base article, we’ll cover how to block bad bots with minimal efforts to keep the trash away from your site and free up valuable hosting resources. Let’s begin!

Add this to the end of your .htaccess:

.htaccess

Example:
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]
RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]
RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]
RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]
RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]
RewriteCond %{HTTP_USER_AGENT} ^Zeus
RewriteRule ^.* - [F,L]