【问题标题】:Site Map index and robots.txt referencing .gz files引用 .gz 文件的站点地图索引和 robots.txt
【发布时间】:2013-08-22 20:31:07
【问题描述】:

对于一个网站,我的站点地图索引文件和我的所有站点地图都经过 gzip 压缩,并具有如下名称(SiteMapIndex.xml.gz、SiteMap1.xml.gz、SiteMap2.xml.gz),应该是 robots.txt文件和 SiteMapIndex.xml 文件是否引用了 gzip 文件名或非 gzip 文件名?

示例 - robots.txt 的内容应该是这样的吗? -

Sitemap: http://www.mysite.com/SiteMapIndex.xml.gz

或者像这样(没有.gz)?

Sitemap: http://www.mysite.com/SiteMapIndex.xml

SiteMapIndex.xml 的内容应该是这样的吗? -

...
<sitemap>
  <loc>http://www.mysite.com/SiteMap1.xml.gz</loc>
  <lastmod>2013-08-20</lastmod>
</sitemap>
<sitemap>
  <loc>http://www.mysite.com/SiteMap2.xml.gz</loc>
  <lastmod>2013-08-20</lastmod>
</sitemap>
...

还是这个(没有.gz)? -

...
<sitemap>
  <loc>http://www.mysite.com/SiteMap1.xml</loc>
  <lastmod>2013-08-20</lastmod>
</sitemap>
<sitemap>
  <loc>http://www.mysite.com/SiteMap2.xml</loc>
  <lastmod>2013-08-20</lastmod>
</sitemap>
...

【问题讨论】:

    标签: search-engine sitemap robots.txt


    【解决方案1】:

    如果您希望机器人读取 .gz 文件,请将 .gz 名称放入索引中。那就是:

    <sitemap>
      <loc>http://www.mysite.com/SiteMap1.xml.gz</loc>
      <lastmod>2013-08-20</lastmod>
    </sitemap>
    <sitemap>
      <loc>http://www.mysite.com/SiteMap2.xml.gz</loc>
      <lastmod>2013-08-20</lastmod>
    </sitemap>
    

    Using Sitemap Index Files

    robots.txt 文件也是如此:输入 gzip 压缩文件的名称。

    Specifying the Sitemap location in your robots.txt file

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-23
      • 1970-01-01
      • 2013-05-01
      • 1970-01-01
      • 2023-04-03
      相关资源
      最近更新 更多