Forum Moderators: phranque
Options +FollowSymlinks
RewriteEngine on
<Files .htaccess>
Order allow,deny
Deny from all
</Files>
#Block by IP
RewriteCond %{REMOTE_HOST} 62.212.73.211 [OR]
# Block By User Agent UA
RewriteCond %{HTTP_USER_AGENT} AhrefsBot/2.0 [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^FLR [NC]
# Block By Browser and User Agent
RewriteCond %{HTTP_USER_AGENT} ^Mozilla\.*Indy [NC]
#Block By Country IP
order allow,deny
allow from all
deny from 2.132.0.0/14 31.11.43.0/24 Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html) How do I decipher the UA from my logs? For example:Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)
I entered the name Baidu and that does not seem to work.
And, my last, most important question. When I entered a UA in my htaccess file, will I still see an entry in my logs for that UA if it tries to access my website.
So, on the RewriteRule, the ^ (caret/circumflex) is an opening anchor that says 'the rule starts here'. And, the $ is telling me that 'the rule stops here', normally.
The entry that I had for the RewriteCond:
RewriteCond %{HTTP_USER_AGENT} ^FLR [NC,OR]
Should have 'activated' the actions of the RewriteRule:
RewriteRule ^.* - [F,L]
The OR, within the brackets, allows me to continue and add more rewrite statements?
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.51 (KHTML, like Gecko; Google Web Preview) Chrome/12.0.742 Safari/534.51 Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html) Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.51 (KHTML, like Gecko; Google Web Preview) Chrome/12.0.742 Safari/534.51
Web\ Preview
Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)