I’ve noticed a lot of unidentified bots crawling my site, all with the user agent string beginning with “Java”.I want to block them via .htaccess, but don’t seem to have any success in doing so. This is my code:
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} ^Java.*
RewriteRule ^/(.*)$ /$1 [F,L]
I have a FF extension that allows me to change my user agent identifier, and I’ve changed it to “Java/1.6.0_27” just like one of the bots I noticed. I’ve verified that it actually changes the string. But if I go to my site, the pages shows up as normal and I am not served a 403 error as I should be.
I have other rewrite rules that work just fine, so I don’t think it’s a server configuration problem. What am I doing wrong?