Im having problems with bot* and *bot. I have limited knowledge of .htaccess but have been blocking bots with .htaccess rules below.
My question is in 2 parts:
*
bot and bot *
Many thanks in advance
#Enable RewriteEngine
RewriteEngine On
# Stop the Nasties!!
RewriteBase /
RewriteCond %{HTTP_USER_AGENT} ^autoemailspider [OR]
RewriteCond %{HTTP_USER_AGENT} baiduspider [NC,OR]
RewriteCond %{HTTP_USER_AGENT} baidu [NC,OR]
RewriteCond %{HTTP_USER_AGENT} Baiduspider [OR]
RewriteCond %{HTTP_USER_AGENT} ^Baiduspider* [OR]
RewriteRule ^.* - [F,L]
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]
RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]
RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]
RewriteCond %{HTTP_USER_AGENT} ^Zeus
RewriteRule ^.* - [F,L]
Yes, it is right way...
And, if you want to block any IP, then as an example:
Order Deny,Allow
Deny from 127.0.0.1
You can combine all those conditions into one as:
RewriteCond %{HTTP_USER_AGENT} (autoemailspider|baidu) [NC]
RewriteRule ^ - [F]
NC
is for ignore case.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.