As of Blackhole Pro version 2.8, it is possible to block specific user agents from accessing your site. This is referred to as “blacklisting” and is the opposite of whitelisting, which also is possible with Blackhole Pro. This quick tutorial explains how to add specific user agents and block them from your site.

About the Blacklisted Bots setting

As explained in the Help tab on the plugin settings page, the new “Blacklisted Bots” Advanced setting enables you to block any bot based on its reported user agent. So for example, if you know of some bots that never should be allowed to access your site, you can add them to this setting and Blackhole will make sure they always are blocked.

Usage Example

To understand how it works, let’s say that our site is getting spammed by some nasty bot. The bot is reporting a user agent of:

SauronBot - One Bot to Spam them All

To block that bot effectively, we want to make sure to get the most unique part of the reported user-agent string. We could use the entire string, like this:

SauronBot - One Bot to Spam them All

But that is cumbersome and not needed for this example. Why? Because the string “SauronBot” is quite unique, and unlikely to false-positive match any other user agents. So we just want to add “SauronBot” to the Blacklisted Bots setting. After doing so, save changes and done. From now on, ol’ SauronBot will be blocked from site access.

Notes

Here are some important notes about this setting:

  • Do not include any special characters.
  • Separate multiple strings with commas.
  • Do NOT include commas for any other reason, they are to be used only as separators.
  • When adding user agents to the list, keep the names short, simple, and as unique as possible.
  • By default, no bots/user-agents are blocked.
  • Remember to test well.

Also note that the plugin’s whitelist settings always will override the blacklist settings.

Important: Commas are used to separate the user-agent strings. Do NOT include them anywhere else.