使用X-Robot-Tag而不是robots.txt有什么好处吗? [英] Is there any advantage of using X-Robot-Tag instead of 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 (withDisallow
)X-Robots-Tag
¹ can disallow indexing (withnoindex
)
(两者都提供其他不同的功能,例如链接到您的站点地图 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屋!