Linux下 規則文件.htaccess (手工創建.htaccess文件到站點根目錄)
<IfModule mod_rewrite.c>
RewriteEngine On
#Block spider
RewriteCond %{HTTP_USER_AGENT} "Webdup|AcoonBot|AhrefsBot|Ezooms|EdisterBot|EC2LinkFinder|jikespider|Purebot|MJ12bot|WangIDSpider|WBSearchBot|Wotbox|xbfMozilla|Yottaa|YandexBot|Jorgee|SWEBot|spbot|TurnitinBot-Agent|mail.RU|curl|perl|Python|Wget|Xenu|ZmEu" [NC]
RewriteRule !(^/robots\.txt$) - [F]
</IfModule>
windows下 規則文件httpd.conf �。ㄔ谔摂M主機控制面板中用 “ISAPI篩選器自定義設置 " 開啟自定義偽靜態 Isapi_Rewite3.1 )
#Block spider
RewriteCond %{HTTP_USER_AGENT} "Webdup|AcoonBot|AhrefsBot|Ezooms|EdisterBot|EC2LinkFinder|jikespider|Purebot|MJ12bot|WangIDSpider|WBSearchBot|Wotbox|xbfMozilla|Yottaa|YandexBot|Jorgee|SWEBot|spbot|TurnitinBot-Agent|mail.RU|curl|perl|Python|Wget|Xenu|ZmEu" [NC]
RewriteRule !(^/robots\.txt$) - [F]
注:規則中默認屏蔽部分不明蜘蛛,要屏蔽其他蜘蛛按規則添加即可
附各大蜘蛛名字:
google蜘蛛: googlebot
百度蜘蛛:baiduspider
yahoo蜘蛛:slurp
alexa蜘蛛:ia_archiver
msn蜘蛛:msnbot
bing蜘蛛:bingbot
altavista蜘蛛:scooter
lycos蜘蛛: lycos_spider_(t-rex)
alltheweb蜘蛛: fast-webcrawler
inktomi蜘蛛: slurp
有道蜘蛛:YodaoBot和OutfoxBot
熱土蜘蛛:Adminrtspider
搜狗蜘蛛:sogou spider
SOSO蜘蛛:sosospider
360搜蜘蛛:360spider