![](/img/trans.png)
[英]Tried to block a click bombing bot in htaccess but it's still getting through. How can I block it for good?
[英]How can I block a Bot with .htaccess
我在bot *和* bot方面遇到問題。 我對.htaccess的了解有限,但是一直在使用以下.htaccess規則阻止漫游器。
我的問題分為兩個部分:
*
bot和bot *
的正確語法? 提前謝謝了
#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]
是的,這是正確的方法...
並且,如果您要阻止任何IP,請以以下示例為例:
Order Deny,Allow
Deny from 127.0.0.1
您可以將所有這些條件合並為:
RewriteCond %{HTTP_USER_AGENT} (autoemailspider|baidu) [NC]
RewriteRule ^ - [F]
NC
是忽略情況。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.