I apologize in advance if this question is very rudimentary. Before I go on, I should note that what I'm about to add here is the result of a lot of research already. I can't claim to understand regular expressions very well, but what I'm facing lately is massive bandwidth suck from UAs that, frankly, I never need/want to see. So, if anyone would be so kind as to comment on what I've got below, including any rookie mistakes, please let me know. I already know this works to block some UAs, but I don't know about all of them - that would suggest it's properly formed, at least for those agents I've confirmed that are blocked. I'm particularly concerned about the "Java" user-agent and I don't know if I need to add a wildcard after it to get every version, or if the ^ character will cover that.
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} ^YandexBot [OR]
RewriteCond %{HTTP_USER_AGENT} ^MJ12bot [OR]
RewriteCond %{HTTP_USER_AGENT} ^libwww-perl [OR]
RewriteCond %{HTTP_USER_AGENT} ^Java [OR]
RewriteCond %{HTTP_USER_AGENT} ^Sogou\ web\ spider [OR]
RewriteCond %{HTTP_USER_AGENT} ^Exabot [OR]
RewriteCond %{HTTP_USER_AGENT} ^Ezooms [OR]
RewriteCond %{HTTP_USER_AGENT} ^Gigabot [OR]
RewriteCond %{HTTP_USER_AGENT} ^discobot [OR]
RewriteCond %{HTTP_USER_AGENT} ^Purebot [OR]
RewriteCond %{HTTP_USER_AGENT} ^Sosospider [OR]
RewriteCond %{HTTP_USER_AGENT} ^Speedy\ Spider [OR]
RewriteCond %{HTTP_USER_AGENT} ^AboutUsBot\ Johnny5 [OR]
RewriteCond %{HTTP_USER_AGENT} ^Python-urllib [OR]
RewriteCond %{HTTP_USER_AGENT} ^Yeti [OR]
RewriteCond %{HTTP_USER_AGENT} ^TurnitinBot [OR]
RewriteCond %{HTTP_USER_AGENT} ^GoScraper [OR]
RewriteCond %{HTTP_USER_AGENT} ^Kehalim [OR]
RewriteCond %{HTTP_USER_AGENT} ^DoCoMo [OR]
RewriteCond %{HTTP_USER_AGENT} ^SurveyBot [OR]
RewriteCond %{HTTP_USER_AGENT} ^spbot [OR]
RewriteCond %{HTTP_USER_AGENT} ^BDFetch [OR]
RewriteCond %{HTTP_USER_AGENT} ^example [OR]
RewriteCond %{HTTP_USER_AGENT} ^EasyDL [OR]
RewriteCond %{HTTP_USER_AGENT} ^CamontSpider [OR]
RewriteCond %{HTTP_USER_AGENT} ^GoScraper [OR]
RewriteCond %{HTTP_USER_AGENT} ^oBot [OR]
RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^Chilkat [OR]
RewriteCond %{HTTP_USER_AGENT} ^ZmEu
RewriteRule ^.* - [F,L]
Again, please be gentle, but if you have any thoughts, questions, suggestions, etc., they are all most welcome.
~Canton