I got my Siteground hosting account suspended yesterday due to the allowed CPU overage. Besides recommendation to disable or control the WP heartbeat API, I was also recommended to block bad bots and bad traffic coming to the site.
The guy on the helpline recommended adding the following few lines into the .htaccess
file:
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} ^$ [OR]
RewriteCond %{HTTP_USER_AGENT} (bot|crawl|robot)
RewriteCond %{HTTP_USER_AGENT} !(Bing|Google|msn|MSR|Twitter|Yandex) [NC]
RewriteRule ^/?.*$ "http\:\/\/127\.0\.0\.1" [R,L]
This code will basically block all bots except "Bing|Google|msn|MSR|Twitter|Yandex".
As I started looking into this more, I've also came across to a few informative videos and tutorials on how to use the .htaccess file to block the bots. For example this video here. But in this case, the guy is adding about 30 lines with the bots that he wants to block instead of bots he want to allow.
Should I be adding a list of bots to ALLOW or should I be adding a list of bots to BLOCK instead?