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?

1
  • I hope my answer will help to do it. Commented Jun 12, 2018 at 6:52

1 Answer 1

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]
1
  • 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
    Commented Jun 12, 2018 at 7:15

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.