html - 指向本地站点地图的 robotext 文件

标签 html seo robots.txt

robots.txt 文件中,是否可以使用相对路径而不是绝对路径来指出站点地图?

Sitemap: http://www.example.com/sitemap.xml

改为:

Sitemap: sitemap.xml

好奇笔记 SO robots.txt

#
# this technically isn't valid, since for some godforsaken reason 
# sitemap paths must be ABSOLUTE and not relative. 
#
Sitemap: /sitemap.xml

最佳答案

The official sitemap documentation在包含对 XML 站点地图位置的引用的示例中显示了完整的 URL。

Sitemap: http://www.example.com/sitemap-host1.xml

但是,它没有指定是否必须使用完整的 URL 或绝对路径。 StackOverflow robots.txt 暗示需要绝对路径,并且他们在使用相对路径时遇到了问题。因此,如果您想确保搜索引擎找到您的站点地图,最好使用完整的 URL 或绝对路径。因为这很容易做到,所以我看不出有任何理由应该使用亲戚。

关于html - 指向本地站点地图的 robotext 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7245590/

相关文章:

html - 我想通过 bootstrap4 在不同的行中制作一个图标,文本

javascript - 如何在python-selenium中获取html元素的 'value'?

javascript - AngularJS - 输入更改传入指令的外部指令值

html - 我可以在 schema.org Rich Snippets 的 Span 标签中使用多个 ItemProps 吗?

javascript - 阻止 Google 为 AngularJS 路由建立索引

html - 无法将链接与背景 div 颜色混合

php - swfAddress、mod_rewrite 和 SEO 的 URL 问题

c# - 如何使用 ASP.NET Web 窗体和路由编写 SEO 友好的图像文件名

php - Google 忽略了我的 robots.txt

java - 使用 Spring MVC 提供 sitemap.xml 和 robots.txt