Site map for multiple domains of the same site

Here's the situation, I have a website that can be accessed from several domains, say www.domain1.com, www.domain2.net, www.domain3.com. domains gain access to the same code base, but different CSS, graphics, etc. are loaded depending on the domain.

everything works fine, but now my question is: how do I deal with sitemap.xml? I wrote a sitemap.xml file for the default domain (www.domain1.com), but what about when the site will be accessible from other domains? the contents of sitemap.xml will contain the wrong domain.

I read that I can add several sitemap files to the robots.txt file, so that means I can create, for example, sitemap-domain2.net.xml and sitemap-domain3.com.xml (containing links with the corresponding domains) and just add them to your robots.txt file?

somehow I have doubts that this will work, so I am contacting you experts to shed light on this topic :)

thanks

+6
source share
3 answers

You must use the server code to send the correct site map based on the domain name for /sitemap.xml requests

+1
source

I am not an expert in this, but I have the same situation.

for my situation is that I have one domain, but with 3 subdomains

so what happens is that each of the subdomains contains a sitemap.xml file

but since my case was a different directory for each of the subdomains

but I'm sure sitemap.xml can indicate for which of each domain.

0
source

You have to make sure that the URLs in each match the XML sitemap in the domain / subdomain . But if you really want to, you can host all Sitemaps in one domain using " Sitemaps and Cross-Messaging"

0
source

Source: https://habr.com/ru/post/891018/


All Articles