2

对于一个网站,我的站点地图索引文件和我的所有站点地图都经过 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>
...
4

1 回答 1

2

如果您希望机器人读取 .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>

请参阅使用站点地图索引文件

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

请参阅在 robots.txt 文件中指定站点地图位置

于 2013-08-22T15:24:02.043 回答