WP-Mix

A fresh mix of code snippets and tutorials

Block BLEXBot via Apache/.htaccess

One of the worst bots I’ve encountered in a long time. BLEXBot likes to hit the same resources periodically and repeatedly. So it requests the same resources again and again, even if they are expressly forbidden via robots.txt or other methods. It’s like BLEXBot has no memory of where it’s been or what it’s doing. Imagine how much time and resources could be saved if stupid bots were just a few kilobytes smarter.

Here is the magic code to Block BLEXBot via .htaccess:

# Block BLEXBot
<IfModule mod_rewrite.c>
	RewriteCond %{HTTP_USER_AGENT} BLEXBot [NC]
	RewriteRule (.*) - [F,L]
</IfModule>

Add that code to your site’s public root .htaccess file (or add via httpd-vhosts.conf in the applicable VirtualHost container), save changes and done. No modifications are required. Works out of the box, set it and forget it my friends. Buh-bye BLEXBot!

Note: BLEXBot is one of many bad bots blocked by my 7G Firewall. So if you’re using 7G, you do NOT need to add the above technique :)

Learn more

.htaccess made easy