使用 X-Robot-Tag 代替 robots.txt 有什么好处吗? [英] Is there any advantage of using X-Robot-Tag instead of robots.txt?

查看:18
本文介绍了使用 X-Robot-Tag 代替 robots.txt 有什么好处吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

看起来有两种主流的解决方案可以指示爬虫索引什么和不索引什么:添加 X-Robot-Tag HTTP 标头,或指示 robots.txt.

It looks like there are two mainstream solutions for instructing crawlers what to index and what not to index: adding an X-Robot-Tag HTTP header, or indicating a robots.txt.

使用前者有什么好处吗?

Is there any advantage to using the former?

推荐答案

使用 robots.txt 您不能禁止对您的文档进行索引.

With robots.txt you cannot disallow indexing of your documents.

他们有不同的目的:

  • robots.txt 可以禁止抓取(使用 Disallow)
  • X-Robots-Tag ¹ 可以禁止 indexing(使用 noindex)
  • robots.txt can disallow crawling (with Disallow)
  • X-Robots-Tag ¹ can disallow indexing (with noindex)

(并且两者都提供其他不同的功能,例如,链接到您的站点地图robots.txt代码>,禁止以下链接X-Robots-Tag,等等.)

(And both offer additional different features, e.g., linking to your Sitemap in robots.txt, disallowing following links in X-Robots-Tag, and many more.)

Crawling 表示访问文档.索引 意味着在索引中提供指向文档的链接(以及可能来自或关于该文档的元数据).在典型情况下,机器人会在抓取文档后对其进行索引,但这不是必需的.

Crawling means accessing the document. Indexing means providing a link to (and possibly metadata from or about) the document in an index. In the typical case, a bot indexes a document after having crawled it, but that’s not necessary.

不允许爬取文档的机器人仍然可以索引它(无需访问它).不允许索引文档的机器人仍然可以抓取它.您不能同时禁止两者.

A bot that isn’t allowed to crawl a document may still index it (without ever accessing it). A bot that isn’t allowed to index a document may still crawl it. You can’t disallow both.

¹ 请注意,标头称为 X-Robots-Tag,而不是 X-Robot-Tag.顺便说一句,元数据名称 robots(用于 HTML meta 元素)是 HTTP 标头的替代项.

¹ Note that the header is called X-Robots-Tag, not X-Robot-Tag. By the way, the metadata name robots (for the HTML meta element) is an alternative to the HTTP header.

这篇关于使用 X-Robot-Tag 代替 robots.txt 有什么好处吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆