robots.txt

robots.txt是放置在域名根目录(如example.com/robots.txt)的纯文本文件,告知合规的网络爬虫网站哪些部分可以访问,哪些不能访问。它使用机器人排除协议指令,如User-agent、Disallow和Allow。通过robots.txt屏蔽某些部分可以为重要页面节省爬取预算,但被屏蔽的页面即使有[[backlinks|反向链接]]也无法被收录——过度屏蔽是常见的SEO失误。该文件还应声明[[sitemap-domain|XML网站地图]]的位置以便爬虫发现。

示例

Adding 'Disallow: /admin/' to robots.txt prevents Google from crawling internal admin pages, while 'Sitemap: https://example.com/sitemap.xml' advertises the sitemap location to all crawlers.