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

查看:135
本文介绍了使用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 可以禁止抓取禁止

  • X-Robots-Tag ¹可以禁止索引(使用 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 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天全站免登陆