如何设置让网站禁止被爬虫抓取收录?
如何设置让网站禁止被爬虫抓取收录?总结了三种方法,可以有效的屏蔽你不喜欢的爬虫,或者是伪装的爬虫,能有效减少服务器的消耗。
一、通过 robots.txt 文件屏蔽
robot.txt只是爬虫禁抓协议,user-agent表示禁止哪个爬虫,disallow告诉爬出那个禁止抓取的目录。
如果爬虫够友好的话,会遵守网站的robot.txt内容。
User-agent: Baiduspider
Disallow: /
User-agent: Googlebot
Disallow: /
User-agent: Googlebot-Mobile
Disallow: /
User-agent: Googlebot-Image
Disallow:/
User-agent: Mediapartners-Google
Disallow: /
User-agent: Adsbot-Google
Disallow: /
User-agent:Feedfetcher-Google
Disallow: /
User-agent: Yahoo! Slurp
Disallow: /
User-agent: Yahoo! Slurp China
Disallow: /
User-agent: Yahoo!-AdCrawler
Disallow: /
User-agent: YoudaoBot
Disallow: /
User-agent: Sosospider
Disallow: /
User-agent: Sogou spider
Disallow: /
User-agent: Sogou web spider
Disallow: /
User-agent: MSNBot
Disallow: /
User-agent: ia_archiver
Disallow: /
User-agent: Tomato Bot
Disallow: /
User-agent: *
Disallow: /
二、通过服务器配置屏蔽
版权声明:本文为原创文章,转载请附上原文出处链接和本声明。
本文链接:https://www.oneue.com/articles/1478.html