5

Within a robots.txt file, would be possible to use a relative path instead of an 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
GibboK
  • 71,848
  • 143
  • 435
  • 658

1 Answers1

3

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.

John Conde
  • 217,595
  • 99
  • 455
  • 496
  • Thanks John for your answer. The reason for my question is: I use a custom CMS that can be used for many websites. I need the User have a out of box fully filled robots.txt with the right parameters without accessing the robots.txt file itself. Because every site has different URL a local path would be an easy solution. I understand your point so the best solution I think would be write the robots.txt file pro-grammatically. – GibboK Aug 31 '11 at 05:12