網站禁止垃圾蜘蛛訪問抓取教程說明

|

很多國外商業蜘蛛實際對網站沒有什麼價值,尤其國內網站的SEO優化運營更是用不上,但是如果不屏蔽就會對網站造成很大的性能寬帶消耗,引起SEO優化負面影響,所以可以根據自己的需要去處理。

nginx服務端禁止Scrapy等工具的抓取

if ($http_user_agent ~* (Scrapy|Curl|HttpClient)) {

return 403;

}

nginx服務端禁止非GET|HEAD|POST方式的抓取

if ($request_method !~ ^(GET|HEAD|POST)$) {

return 403;

}

nginx服務端禁止指定蜘蛛抓取

if ($http_user_agent ~ "MegaIndex|MegaIndex.ru|BLEXBot|Qwantify|qwantify|semrush|Semrush|serpstatbot|hubspot|python|Bytespider|Go-http-client|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;

}

IIS服務端

<?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="MegaIndex|MegaIndex.ru|BLEXBot|Qwantify|qwantify|semrush|Semrush|serpstatbot|hubspot|python|Bytespider|Go-http-client|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|^$"

ignoreCase="true" />

</conditions>

<action type="AbortRequest" />

</rule>

</rules>

</rewrite>

</system.webServer>

</configuration>

IIS6請在isapi重寫組件中添加規則

#Block spider

RewriteCond %{HTTP_USER_AGENT} (MegaIndex|MegaIndex.ru|BLEXBot|Qwantify|qwantify|semrush|Semrush|serpstatbot|hubspot|python|Bytespider|Go-http-client|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|^$) [NC]

RewriteRule !(^/robots.txt$) - [F]

apache服務端

<IfModule mod_rewrite.c>

RewriteEngine On

#Block spider

RewriteCond %{HTTP_USER_AGENT} "MegaIndex|MegaIndex.ru|BLEXBot|Qwantify|qwantify|semrush|Semrush|serpstatbot|hubspot|python|Bytespider|Go-http-client|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|^$" [NC]

RewriteRule !(^robots\.txt$) - [F]

</IfModule>

通過robots.txt禁止

對於遵循robots協議的蜘蛛,可以直接在robots禁止。上面常見的無用蜘蛛禁止方法如下,將下麪的內容加入到網站根目錄下麪的robots.txt就可以了。常見的一些屏蔽惡意蜘蛛代碼如下,也可以根據自己需要進行增減。

User-agent: SemrushBot

Disallow: /

User-agent: DotBot

Disallow: /

User-agent: MegaIndex.ru

Disallow: /

User-agent: MauiBot

Disallow: /

User-agent: AhrefsBot

Disallow: /

User-agent: MJ12bot

Disallow: /

User-agent: BLEXBot

Disallow: /

常見的網絡惡意垃圾爬蟲蜘蛛

上面說的搜索引擎爬蟲能給網站帶來流量,也有許多爬蟲除了增加服務器負擔,對網站沒任何好處,應該屏蔽掉。

1、MJ12Bot

MJ12Bot 是英國著名SEO公司Majestic的網絡爬蟲,其抓取網頁給需要做SEO的人用,不會給網站帶來流量。

2、AhrefsBot

AhrefsBot 是知名SEO公司Ahrefs的網頁爬蟲。其同樣抓取網頁給SEO專業人士用,不會給網站帶來流量。

3、SEMrushBot

SEMrushBot 也是SEO、營銷公司的網絡爬蟲。

4、DotBot

DotBot 是 Moz.com 的網頁爬蟲,抓取數據用來支持 Moz tools 等工具。

5、MauiBot

MauiBot 不同於其他爬蟲,這個爬蟲連網站都沒有,UA只顯示一個郵箱:”MauiBot (crawler.feedback+wc@gm ail.com)“。神奇的是這個看起來是個人爬蟲,竟然遵循robots協議,算得上垃圾爬蟲的一股清流。

6、MegaIndex.ru

這是一個提供反向鏈接查詢的網站的蜘蛛,因此它爬網站主要是分析鏈接,並沒有什麼作用。遵循robots協議。

7、BLEXBot

這個是webmeup下麪的蜘蛛,作用是收集網站上面的鏈接,對我們來說並沒有用處。遵循robots協議。

結語:以上來源收集彙總,請根據自己實際需要進行準確設置。

警惕垃圾蜘蛛影響網站SEO收錄排名