1

We have 2 domains: www.website.com and www.website.ca

Both websites are using the same root folder on the same Magento instance. What is the best way to create sitemaps for each site that use the same directory?

  • I hope my answer will help to do it. – Nikunj Vadariya Jun 12 '18 at 6:52
1

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

/sitemaps/domain1/

/sitemaps/domain2/

Then login to the Magento admin > Marketing > Site map

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.

/sitemaps/domain1/

/sitemaps/domain2/

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:

Sitemap: http://www.domain1.com/sitemaps/domain1/sitemap.xml
Sitemap: http://www.domain2.com/sitemaps/domain2/sitemap.xml

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

You need to rewrites in .htaccess

And add the following redirect statements:

Sitemap: http://www.domain1.com/sitemaps/domain1/sitemap.xml

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

# Sitemap: http://www.domain2.com/sitemaps/domain2/sitemap.xml
RewriteCond %{HTTP_HOST} ^.*domain2\.com$
RewriteRule ^sitemap.xml$ sitemaps/domain2/sitemap.xml [NC,L,R=301]
  • I have one issue where the htaacess redirects to the .html sitemap even though the sitemap url in browser says website.com/sitemap.xml - is this normal – JronCh Jun 12 '18 at 7:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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