I've a website


and subdomains aaa.example.com, bbb.example.com.

I've URLs:

  • www.example.com/category1
  • www.example.com/category2
  • aaa.example.com/aaa-category1

All domain and subdomains hosted in one place.

If I want to create sitemaps

  • www.example.com/sitemap.xml
  • and aaa.example.com/sitemap.xml

but here for both domain and subdomains sitemap.xml destination is same.

How to create sitemaps for all subdomains and how to submit into search console from subdomain property.

1 Answer 1


The XML sitemap file doesn't need to be called sitemap.xml. You can call it anything you like. eg. sitemap-aaa.xml.

This is a machine readable file, so you shouldn't necessarily be concerned about what the URL looks like.

However, if you specifically wanted www.example.com/sitemap.xml and aaa.example.com/sitemap.xml to be accessible and refer to different files, despite your subdomains pointing to the same place, then you could rewrite the URL. You would still need a sitemap-aaa.xml (or similar) file stored on the filesystem.

For example, using an Apache .htaccess file (in the document root) with mod_rewrite:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^(aaa|bbb)\.example\.com
RewriteRule ^sitemap\.xml$ sitemap-%1.xml [L]

The above would internally rewrite a request for aaa.example.com/sitemap.xml or bbb.example.com/sitemap.xml to sitemap-aaa.xml and sitemap-bbb.xml respectively.

You could consider storing these files in a separate directory and blocking direct access to that directory.

However, as mentioned above, since XML sitemap files can be named (and stored) anything you like, there would not seem to be an obvious need to do this.

Providing both subdomains are validated in GSC, you can also have a single sitemap that contains the URLs from both subdomains. (Works with Google at least: https://webmasters.googleblog.com/2007/10/dealing-with-sitemap-cross-submissions.html)

  • @Bhaskar How did you get on with this? If this answered your question then please mark it as accepted (checkmark below the voting arrows on the left) to remove it from the unanswered question queue. Once you have 15+ rep then you can also upvote answers you find useful. Thanks, much appreciated. :)
    – MrWhite
    May 14, 2019 at 22:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.