: How to have multiple sitemaps for multiple domains hosted on one hosting account? I have two domains pointing to the same hosting account. My code in the index.php page recognizes which domain
I have two domains pointing to the same hosting account. My code in the index.php page recognizes which domain and shows different content for each domain. However, both domains have the same sitemap.xml because there is only one sitemap in the public_html directory.
Is it possible to have two distinct sitemaps for the two domains?
More posts by @Correia994
3 Comments
Sorted by latest first Latest Oldest Best
So to be clear I will start from the WMT and work back to your server. Tl;DR Yes you can.
Each domain needs to have a separate WMT account for both it and for its version. Specify the preferred domain.
Put each domains sitemap in a separate, DIFFERENT NAMED, folder. Ensure you can publicly resolve that sitemap. Test the sitemap with WMT.
Browse to that folder and submit the sitemap.xml for each domain.
Verify in a day that it is crawling appropriately.
This does not depend on anything external to your current setup. You already have resolution sorted out.
This way comes straight out of our .htaccess and works like a charm:
RewriteCond %{HTTP_HOST} ^.*myhost.com$
RewriteRule ^sitemap.xml$ sitemap-com.xml [NC]
RewriteCond %{HTTP_HOST} ^.*myhost.ca$
RewriteRule ^sitemap.xml$ sitemap-ca.xml [NC]
You can use 2 different sitemap files and add these seperate files to Google Webmaster Tools:
/sitemap1.xml
/sitemap2.xml
Another option is to use a rewriting mechanism to rewrite calls to the corresponding sitemap file. Using .htaccess or IIS-rewrite.
domain1.com/sitemap.xml rewrites to /sitemap1.xml
domain2.com/sitemap.xml rewrites to /sitemap2.xml
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.