robotext file pointing to a local sitemap
Within a robots.txt
file, would be possible to use a relative path instead of an开发者_StackOverflow社区 absolute one for pointing out a Sitemap?
Sitemap: http://www.example.com/sitemap.xml
instead:
Sitemap: sitemap.xml
Curiose note 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 shows a complete URL in its example of including a reference to an XML sitemap location.
Sitemap: http://www.example.com/sitemap-host1.xml
However, it does not specify whether or not a complete URL or absolute path must be used. The StackOverflow robots.txt implies that an absolute path is required and that they had issues when they used a relative path. So it is probably best to use a complete URL or absolute path if you want to be certain that search engines find your sitemap. Since this is very easy to do I don't see any reason why a relative should be used.
精彩评论