Magento Sitemaps for Multistore Instances

This image is courtesy of the internet.

Sitemaps are an important part of every eCommerce website. They help search engines find and index your products and content. However, when creating a mutli-store site using Magento, if you’ve tried to setup multiple sitemap files, you’ve probably seen the message –

filename.xml is not available and cannot be used.”

This odd error message comes from a small bug that forces Magento to only use a file named sitemap.xml to store the sitemap in. So if you have multiple stores and domains, all of the sites will use the same file and each will continually overwrite the sitemap with their own information.

This has the adverse affect of confusing the search engine spiders. Because regardless of which of your domains it’s trying to index, the content of the sitemap file will contain only the information for whichever domain the sitemap generator indexed most recently.

Fortunately, there is an easy fix. You can create different directories for each domain to store the sitemap.xml files. This will require that you, or your developer, have access to the server to create folders and update files.

Note: Some of these actions require modifying files on your site. If you don’t have access or don’t feel comfortable doing it, please contact your developer or hosting company and they can easily make these updates.

  • First, create a new folder called sitemaps in the root of your website, then create subfolders for each domain.


  • Then login to the Magento admin and navigate to –

catatlog -> google sitemap

Create or edit the sitemap listings for each store and set the “path to sitemap” field to be the path you created for the store.


  • Update your robots.txt file. To make sure that the search engine spiders are properly directed to the new sitemaps. You may need to update or create the robots.txt file. Edit the robots.txt file and add the following lines at the top —

# Website Sitemap

  • Finally, if your site uses the Apache web server engine, you should update the .htaccess
    file in the root of your website to direct any other sitemap requests to the proper place.
    Locate the following line below the line that reads —

RewriteEngine on

And add the following redirect statements below it —

RewriteCond %{HTTP_HOST} ^.*domain_1\.com$
RewriteRule ^sitemap.xml$ sitemaps/domain_1/sitemap.xml [NC,L,R=301]

RewriteCond %{HTTP_HOST} ^.*domain_2\.com$
RewriteRule ^sitemap.xml$ sitemaps/domain_2/sitemap.xml [NC,L,R=301]

And that’s it.  Make sure to regenerate the sitemaps for all your stores and then try to view them in the browser.  You can test the .htaccess redirects by navigating in your browser to and to make sure that the links actually go to the correct sites.