We have different domains for each language
And then we have different sitemap.xml for each site. In robots.txt, I want to add sitemap reference for each domain.
Beyond www and non-www, a site can have a robots. txt file sitting at the https version of a subdomain and then also at the http version of that subdomain. So, similar to what I explained above, there could be multiple robots. txt files with different instructions based on protocol.
Each subdomain is generally treated as a separate site and requires their own robots. txt file.
Your site can have only one robots. txt file.
The robots. txt file helps major search engines understand where they're allowed to go on your website. But, while the major search engines do support the robots.
I'm using the following solution in .htaccess after all domain redirects and www to non-www redirection.
# Rewrite URL for robots.txt
RewriteRule ^robots\.txt$ robots/%{HTTP_HOST}.txt [L]
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With