apache、iis規(guī)則屏蔽攔截蜘蛛抓取
如果是正常的搜索引擎蜘蛛訪問,不建議對蜘蛛進行禁止,否則網(wǎng)站在百度等搜索引擎中的收錄和排名將會丟失,造成客戶流失等損失。
可以優(yōu)先考慮升級虛擬主機型號以獲得更多的流量或升級為云服務器(不限流量)。更多詳情請訪問: http://www.west.cn/faq/list.asp?unid=626
Linux下規(guī)則文件.htaccess(手工創(chuàng)建.htaccess文件到站點根目錄)
<IfModule mod_rewrite.c>
RewriteEngine On
#Block spider
RewriteCond %{HTTP_USER_AGENT} "SemrushBot|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>
Windows2008、2012或更高系統(tǒng)下規(guī)則文件web.config (手工創(chuàng)建web.config文件到站點根目錄)
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Block spider">
<match url="(^robots.txt$)" ignoreCase="false" negate="true" />
<conditions>
<add input="{HTTP_USER_AGENT}" pattern="SemrushBot|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" ignoreCase="true" />
</conditions>
<action type="AbortRequest"/>
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
注:“{HTTP_USER_AGENT}”所在行中是不明蜘蛛名稱,根據(jù)需要添加以"|"為分割。
規(guī)則中默認屏蔽部分不明蜘蛛,要屏蔽其他蜘蛛按規(guī)則添加即可,附各大蜘蛛名字:
google蜘蛛:googlebot
百度蜘蛛:baiduspider
百度手機蜘蛛:baiduboxapp
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
apache、iis屏蔽限制ip訪問(適用虛擬主機)
來源:西部數(shù)碼