IIS设置文件 Robots.txt 禁止爬虫
robots.txt用于禁止网络爬虫访问网站指定目录。robots.txt的格式采用面向行的语法:空行、注释行(以#打头)、规则行。规则行的格式为:Field: value。常见的规则行:User-Agent、Disallow、Allow行。
User-Agent行
User-Agent: robot-name
User-Agent: *
Disallow和Allow行
Disallow: /path
Disallow: # 空字符串,起通配符效果,全禁止 Allow: /path
Allow: # 空字符串,起通配符效果,全允许
搜索引擎的User-Agent对应名称
| 搜索引擎 | User-Agent值 |
|---|---|
| googlebot | |
| 百度 | baiduspider |
| 雅虎 | slurp |
| MSN | msnbot |
| Alexa | is_archiver |
我在Linux上抓包观察到的一些搜索引擎访问记录:
# tcpdump -n -nn -A -l -s1024 'tcp port 80'|grep User-Agent
User-Agent: Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)
User-Agent: Googlebot-Image/1.0
User-Agent: Feedfetcher-Google; (+http://www.google.com/feedfetcher.html; 5 subscribers; feed-id=4619555564728728616)
User-Agent: Mozilla/5.0(compatible; Sosospider/2.0; +http://help.soso.com/webspider.htm)
User-Agent: Mozilla/5.0 (compatible; YoudaoBot/1.0; http://www.youdao.com/help/webmaster/spider/; )
User-Agent: Mozilla/5.0 (compatible; JikeSpider; +http://shoulu.jike.com/spider.html)
JikeSpider是即刻搜索(人民搜索)。
robots.txt的补充
如果你没有对网站根目录的写入权限(无法建立robots.txt文件),或你想要某个指定的网页不被搜索引擎收录,可以使用元标签阻止爬虫访问:
name="robots" content="noindex"> name="googlerobot" content="noindex">
robots元标记的默认值为"index,follow",它的取值可以是(来自Google站长帮助):
- noindex
- 防止网页被编入索引。
- nofollow
- 防止googlebot从此页面中跟踪链接。
- noarchive
- 防止Google显示网页的快照链接。
- noimageindex
- 不被Google图片搜索索引。
现实中的robots.txt
淘宝屏蔽百度
淘宝屏蔽了百度抓取(2008年9月),http://www.taobao.com/robots.txt的内容:
User-agent: Baiduspider
Disallow: / User-agent: baiduspider
Disallow: /
百度与360的搜索引擎之争
2012年8月,360推出搜索引擎,并与百度发生正面冲突。百度工程师跑出来说360违反robots协议,偷窃百度内容。以百度知道为例,http://zhidao.baidu.com/robots.txt的内容大致是这样:
User-agent: Baiduspider
Disallow: /w?
Allow: / User-agent: Googlebot
User-agent: MSNBot
User-agent: Baiduspider-image
User-agent: YoudaoBot
User-agent: Sogou web spider
User-agent: Sogou inst spider
User-agent: Sogou spider2
User-agent: Sogou blog
User-agent: Sogou News Spider
User-agent: Sogou Orion spider
User-agent: JikeSpider
User-agent: Sosospider
Allow: / User-agent: *
Disallow: /
也就是说对360爬虫而言,应该走最后一条规则,也就是禁止抓取百度知道所有内容。但从360搜索看,有百度知道的内容。
IIS设置文件 Robots.txt 禁止爬虫的更多相关文章
- Robots.txt - 禁止爬虫(转)
Robots.txt - 禁止爬虫 robots.txt用于禁止网络爬虫访问网站指定目录.robots.txt的格式采用面向行的语法:空行.注释行(以#打头).规则行.规则行的格式为:Field: v ...
- Robots.txt - 禁止爬虫
robots.txt用于禁止网络爬虫访问网站指定目录.robots.txt的格式采用面向行的语法:空行.注释行(以#打头).规则行.规则行的格式为:Field: value.常见的规则行:User-A ...
- robots.txt网站爬虫文件设置
目录: 什么是robots.txt robots.txt使用误区 robots.txt使用技巧 什么是robots.txt? robots.txt是搜索引擎中访问网站的时候要查看的第一个文件.Robo ...
- 通过[蜘蛛协议]Robots.txt禁止搜索引擎收录的方法
什么是robots.txt文件? 搜索引擎通过一种程序robot(又称spider),自动访问互联网上的网页并获取网页信息. 您可以在您的网站中创建一个纯文本文件robots.txt,在这个文件中 ...
- robots.txt禁止搜索引擎收录
禁止搜索引擎收录的方法 一.什么是robots.txt文件? 搜索引擎通过一种程序robot(又称spider),自动访问互联网上的网页并获取网页信息. 您可以在您的网站中创建一个纯文 ...
- 网站的根目录下有一个文件robots.txt ,它是啥?
我相信很多人有过这个疑问,这个robots文件是干嘛的? 我想问,各位搜索淘宝时,是否发现(禁止爬虫抓取提供快页) 关于详细语法,请看:http://zhidao.baidu.com/question ...
- website robots.txt 防爬虫 措施
robots.txt文件用法举例: 1. 允许所有的robot访问 User-agent: * Allow: / 或者 User-agent: * Disallow: 2. 禁止所有搜索引擎访问网站的 ...
- IIS 设置文件传输大小限制
IIS默认传输文件大小为30M,最大允许传输为2G. 1.通过webconfig配置节点设置 在IIS 6.0 设置如下配置节点: 但是IIS 7.0-8.0还要做添加如下配置节点才能正确,否则还是默 ...
- nginx通过robots.txt禁止所有蜘蛛访问(禁止搜索引擎收录)
在server {} 块中添加下面的配置 location =/robots.txt { default_type text/html; add_header Content-Type "t ...
随机推荐
- [转]Ubuntu 12.04.3 LTS 安装 Qt5.1.1
参考文档如下: http://blog.csdn.net/astonqa/article/details/9767043 http://www.qtcn.org/bbs/apps.php?q=diar ...
- 基于部标Jt/T809协议和Java Netty框架构建Gps位置监控平台
现在地方上由于运输车辆的GPS数据都分散在地方上已有的各种企业平台上面,不利于大数据的分析和智能应用,而开发智能的基于大数据的Gps监控平台,往往需要和各种第三方的部标GPS监控平台对接,获取到第三方 ...
- SPI_FLASH时序描述及驱动编程
推荐 分享一个朋友的人工智能教程,零基础!通俗易懂!希望你也加入到人工智能的队伍中来! http://www.captainbed.net/strongerhuang Ⅰ.写在前面 前面文章讲述过关于 ...
- MapReduce实战(五)实现关联查询
需求: 利用MapReduce程序,实现SQL语句中的join关联查询. 订单数据表order: id date pid amount 1001 20150710 P0001 2 1002 20150 ...
- 每隔10秒自动更新svn 定时更新svn 脚本
任务: */1 * * * * /opt/adobe/fms/webroot/api/svn.sh 这个命令的问题:只更新了版本号,没有更新实际内容,但是直接运行上面shell脚本能更新. 解决:需要 ...
- linux在桌面和dos之间的切换
在linux 终端执行某条命令(init 5)时 提示一下错误 init :Need to be root 是提示要获取root权限 输入su 回车输入密码
- datagrid多复选框
<!DOCTYPE html><html><head> <meta charset="UTF-8"> <title>Ch ...
- 第一百五十二节,封装库--JavaScript,表单验证--年月日注入
封装库--JavaScript,表单验证--年月日注入 效果图 html <div id="reg"> <h2 class="tuo"> ...
- centos7 安装kvm虚拟机
准备工作 centos7 光盘文件 物理机(>=4 Cores; >= 4GB memory; >= 40G disk size) 参考文档:KVM Virtualization i ...
- curl使用例子
地址:http://phpbook.phpxy.com/34771 参考:http://php.net/manual/zh/function.curl-setopt.php 我们将curl的步骤分为以 ...