PHP程序员站--PHP编程开发平台
 当前位置:主页 >> 网页制作 >> SEO >> 

SiteMaps格式标准

SiteMaps格式标准

来源:phperz.com  作者:phperz.com  发布时间:2009-10-11
Sitemap 的 XML 格式 Sitemaps 协议格式由 XML 标记组成。Sitem

Sitemap 文件位置
Sitemap 文件的位置决定该 Sitemap 中可以包含的网址组。位于 http://example.com/catalog/sitemap.xml 的 Sitemap 文件可以包含任何以 http://example.com/catalog/ 开头的网址,但不能包含以 http://example.com/images/ 开头的网址。

如果您有更改 http://example.org/path/sitemap.xml 的权限,那么应该也可以提供前缀为 http://example.org/path/ 的网址信息。在 http://example.com/catalog/sitemap.xml 中,视为有效的网址示例包括:

http://example.com/catalog/show?item=23
http://example.com/catalog/show?item=233&user=3453
http://example.com/catalog/sitemap.xml 中无效的网址包括:

http://example.com/image/show?item=23
http://example.com/image/show?item=233&user=3453
https://example.com/catalog/page1.html
注意,这表示 Sitemap 中列出的所有网址都必须使用相同的协议(在本例中为 http)并位于在 Sitemap 所在的主机上。例如,如果 Sitemap 位于 http://www.example.com/sitemap.xml,则不能包含 http://subdomain.example.com 上的网址。

被认定为无效的网址将不再作进一步考虑。强烈建议将 Sitemap 放在网络服务器的根目录处。例如,如果网络服务器位于 example.com,则 Sitemap 索引文件应位于 http://example.com/sitemap.xml。在某些情况下,您需要针对不同的路径创建不同的 Sitemap,例如,当您公司的安全许可对应不同的目录划分写入权限时。

如果您使用带端口号的路径提交 Sitemap,那么 Sitemap 文件中列出的每个网址中都应包含该端口号,作为路径的一部分。例如,如果 Sitemap 位于 http://www.example.com:100/sitemap.xml,那么 Sitemap 中列出的每个网址必须以 http://www.example.com:100 开头。

Sitemap & 交叉提交
若要从一个主机为多个主机提交 Sitemap,对于要在 Sitemap 中提交网址的这些主机,需要证明您具有其所有权。请看下面的示例。我们假定您要为 3 个主机提交 Sitemap:

www.host1.com,Sitemap 文件 sitemap-host1.xml
www.host2.com,Sitemap 文件 file sitemap-host2.xml
www.host3.com,Sitemap 文件 file sitemap-host3.xml

而且,您想将三个 Sitemap 全部放在一个主机上:www.sitemaphost.com。因此,Sitemap 的网址将是:

http://www.sitemaphost.com/sitemap-host1.xml
http://www.sitemaphost.com/sitemap-host2.xml
http://www.sitemaphost.com/sitemap-host3.xml

默认情况下,这样会出现“交叉提交”的错误,因为您在试图使用 www.sitemaphost.com 上存放的 Sitemap 提交 www.host1.com 的网址(另外两个主机情况相同)。避免此错误的方法之一是证明您具有 www.host1.com 的所有权(即有权修改文件)。另一种方法是在 www.host1.com 上修改 robots.txt 文件,使其指向 www.sitemaphost.com 中的 Sitemap。

在此示例中,http://www.host1.com/robots.txt 中的 robots.txt 文件应包含一行“Sitemap: http://www.sitemaphost.com/sitemap-host1.xml”。通过修改 www.host1.com 上的 robots.txt 文件,并将其指向 www.sitemaphost.com 中的 Sitemap,可间接证明您具有 www.host1.com 的所有权。换言之,管理 www.host1.com 上 robots.txt 文件的人认为 http://www.sitemaphost.com/sitemap-host1.xml 上的 Sitemap 中包含 www.host1.com 的网址。对于其他两台主机,可以重复相同的步骤。

现在您可以在 www.sitemaphost.com 上提交 Sitemap 了。

当某主机的 robots.txt(即 http://www.host1.com/robots.txt)指向另一主机上的 Sitemap 或 Sitemap 索引时;对于每个目标 Sitemap(如 http://www.sitemaphost.com/sitemap-host1.xml),其中的所有网址均属于指向该 Sitemap 的主机。原因如上所述,Sitemap 中的网址只能来自于同一个主机。


延伸阅读:
网站地图链接放在robots.txt文件里的用处
dedecms生成xml格式网站地图

Tags: sitemaps   标准   it   em   格式   PS   sitemap  
最新文章
推荐阅读
月点击排行榜
PHP程序员站 Copyright © 2007-2010,PHPERZ.COM All Rights Reserved 粤ICP备07503606号