【发布时间】:2018-07-23 05:53:30
【问题描述】:
我们有大量的 URL,其中一些包含哈希字符。哈希 不是 表示片段,而是 URL 路径的一部分,所以我们通过 %23 对哈希进行转义,例如
http://example.com/example%231
http://example.com/another-example%232
…
我们的sitemap.xml 列出这些网址如下:
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>http://example.com/example%231</loc>
</url>
<url>
<loc>http://example.com/another-example%232</loc>
</url>
<!-- and so on … -->
</urlset>
现在,Google Search Console 报告以下网址的 404 错误:
http://example.com/example
http://example.com/another-example
请注意,%23 之后的字符串已被删除。如果站点地图包含例如,我会理解这种行为。 http://example.com/example#1,但我们有意对哈希进行编码 (http://example.com/example%231)。
有什么我可能误解的地方,或者sitemap.xml内有什么特殊的转义规则吗?
【问题讨论】:
标签: google-search-console xml-sitemap url-fragment