如何使用robots.txt禁用sitemap.xml

时间:2016-01-19 09:41:04

标签: robots.txt sitemap.xml

我的网站有自定义robots.txt。 我有兴趣禁止使用sitemap.xml,所以我的问题是:写下来是否足够:

Disallow: /sitemap.xml ?

1 个答案:

答案 0 :(得分:0)

此robots.txt

User-agent: *
Disallow: /sitemap.xml

允许所有机器人抓取您主机上的所有内容,但路径以/sitemap.xml开头的网址除外。因此,不应抓取这些网址:

  • http://example.com/sitemap.xml
  • http://example.com/sitemap.xml.tar.gz
  • http://example.com/sitemap.xml/
  • http://example.com/sitemap.xml/foo

因此,如果您的站点地图位于http://example.com/sitemap.xml,那么符合规定的机器人不会抓取它。