robots.txt

Rails 中的 robots.txt

# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
#
# To ban all spiders from the entire site uncomment the next two lines:
# User-agent: *
# Disallow: /
User-agent:* ”表示本节适用于所有机器人。“ Disallow:/ ”告诉机器人它不应该访问网站上的任何页面。

使用/robots.txt时有两个重要的注意事项:

机器人可以忽略您的/robots.txt。特别是扫描Web的恶意软件机器人的安全漏洞,以及垃圾邮件发送者使用的电子邮件地址收集器将不会引起注意。
/robots.txt文件是公开可用的文件。任何人都可以看到您的服务器的哪些部分不希望机器人使用。
# https://www.taobao.com/robots.txt 页面

User-agent:  Baiduspider
Allow:  /article
Allow:  /oshtml
Allow:  /wenzhang
Disallow:  /product/
Disallow:  /

User-Agent:  Googlebot
Allow:  /article
Allow:  /oshtml
Allow:  /product
Allow:  /spu
Allow:  /dianpu
Allow:  /wenzhang
Allow:  /oversea
Allow:  /list
Disallow:  /

User-agent:  Bingbot
Allow:  /article
Allow:  /oshtml
Allow:  /product
Allow:  /spu
Allow:  /dianpu
Allow:  /wenzhang
Allow:  /oversea
Allow:  /list
Disallow:  /

User-Agent:  360Spider
Allow:  /article
Allow:  /oshtml
Allow:  /wenzhang
Disallow:  /

User-Agent:  Yisouspider
Allow:  /article
Allow:  /oshtml
Allow:  /wenzhang
Disallow:  /

User-Agent:  Sogouspider
Allow:  /article
Allow:  /oshtml
Allow:  /product
Allow:  /wenzhang
Disallow:  /

User-Agent:  Yahoo!  Slurp
Allow:  /product
Allow:  /spu
Allow:  /dianpu
Allow:  /wenzhang
Allow:  /oversea
Allow:  /list
Disallow:  /

User-Agent:  *
Disallow:  /
回答: Robots.txt是一个约定、协议,是网站和搜索引擎爬虫之间的协议文件。它以简单的txt格式文本方式告诉搜索引擎爬虫被允许的权限,用来控制搜索引擎爬虫对网站的访问范围。当一个搜索蜘蛛访问一个站点时,它会首先检查该站点根目录下是否存在robots.txt文件,如果存在,搜索机器人就会按照该文件中的内容来确定访问的范围;如果该文件不存在,所有的搜索蜘蛛将能够访问网站上所有没有被口令保护的页面。\[3\]Robots.txt的作用是为了更好地被搜索引擎收录,站点可以通过设置robots.txt来控制搜索引擎爬虫的访问权限。\[2\]如果站点希望封禁某些页面,真正的封禁并不是靠user-agent来实现,而是通过其他方式来实现。\[2\]如果需要生成或检测Robots.txt文件,可以使用一些在线工具,如站长工具Robots.txt生成、便民查询网Robots.txt生成器、Tool在线工具等。\[1\] #### 引用[.reference_title] - *1* *3* [什么是robots.txt文件](https://blog.csdn.net/qq_41092170/article/details/117701816)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^koosearch_v1,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [【每天学习一点新知识】robots.txt详解](https://blog.csdn.net/m0_51683653/article/details/127252676)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^koosearch_v1,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值