apache、iis6、ii7獨(dú)立ip主機(jī)屏蔽攔截蜘蛛抓取(適用vps云主機(jī)服務(wù)器)
如果是正常的搜索引擎蜘蛛訪問,不建議對蜘蛛進(jìn)行禁止,否則網(wǎng)站在百度等搜索引擎中的收錄和排名將會(huì)丟失,造成客戶流失等損失??梢詢?yōu)先考慮升級虛擬主機(jī)型號以獲得更多的流量或升級為云服務(wù)器(不限流量)。更多詳情請?jiān)L問: http://www.west.cn/faq/list.asp?unid=626
1. 使用網(wǎng)站管理助手環(huán)境:http://www.west.cn/faq/list.asp?unid=650 參考此說明啟用設(shè)置偽靜態(tài)組件
2. windows2003+iis手工建站環(huán)境:http://www.west.cn/faq/list.asp?unid=639 參考此說明加載偽靜態(tài)組件
3. 然后在配置文件中按以下系統(tǒng)規(guī)則配置
Linux下 規(guī)則文件.htaccess(手工創(chuàng)建.htaccess文件到站點(diǎn)根目錄)
<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>
windows2003下 規(guī)則文件httpd.conf
#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]
windows2008下 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|curl|perl|Python|Wget|Xenu|ZmEu" ignoreCase="true" />
</conditions>
<action type="AbortRequest" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Nginx對應(yīng)屏蔽規(guī)則
代碼需添加到對應(yīng)站點(diǎn)配置文件server段內(nèi)
if ($http_user_agent ~ "Bytespider|Java|PhantomJS|SemrushBot|Scrapy|Webdup|AcoonBot|AhrefsBot|Ezooms|EdisterBot|EC2LinkFinder|jikespider|Purebot|MJ12bot|WangIDSpider|WBSearchBot|Wotbox|xbfMozilla|Yottaa|YandexBot|Jorgee|SWEBot|spbot|TurnitinBot-Agent|mail.RU|perl|Python|Wget|Xenu|ZmEu|^$" )
{
return 444;
}
注:規(guī)則中默認(rèn)屏蔽部分不明蜘蛛,要屏蔽其他蜘蛛按規(guī)則添加即可
附各大蜘蛛名字:
google蜘蛛:googlebot
百度蜘蛛:baiduspider
百度手機(jī)蜘蛛: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
來源:西部數(shù)碼