We have different domains for each language
- www.abc.com
- www.abc.se
- www.abc.de
And then we have different sitemap.xml for each site. In robots.txt, I want to add sitemap reference for each domain.
- Is it possible to have multiple sitemap references for each domain in single robots.txt?
- If there are multiple, which one does it pick?
Based on Hans2103's answer, I wrote this one that should be safe to be included in just about every web project:
This rewrite condition should just serve the normal
robots.txt
if it's present and only look for arobots/
directory with the specified filerobots/<domain.tld>.txt
.N.B.: The above rewrite has not yet been tested. Feel free to correct me if you find any flaws; I will update this post for future reference upon any helpful corrective comments.
I'm using the following solution in .htaccess after all domain redirects and www to non-www redirection.
Create a new directory in your root called robots. Create a text file filled with the specific robots information for every domain.
The robots.txt can only inform the search engines of sitemaps for its own domain. So that one will be the only one it honors when it crawls that domain's robots.txt. If all three domains map to the same website and share a robots.txt then the search engines will effectively find each sitemap.