2013-08-20 93 views
2

對於一個網站,我的網站地圖索引文件和所有我的網站地圖都是gzip,並具有如下名稱(SiteMapIndex.xml.gz,SiteMap1.xml.gz,SiteMap2 .xml.gz),robots.txt文件和SiteMapIndex.xml文件是否應該引用gzip文件名或非gzip文件名?網站地圖索引和robots.txt引用.gz文件

示例 - 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> 
... 

or this(without the .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> 
... 

回答

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> 

請參閱Using Sitemap Index Files

對於您的robots.txt文件也是這樣:放入gzip文件的名稱。

請參閱Specifying the Sitemap location in your robots.txt file