Mobile app version of vmapp.org
Login or Join
Correia994

: 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

@Correia994

Posted in: #Domains #Sitemap #WebHosting

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?

10.03% popularity Vote Up Vote Down


Login to follow query

More posts by @Correia994

3 Comments

Sorted by latest first Latest Oldest Best

 

@Nimeshi995

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.

10% popularity Vote Up Vote Down


 

@Reiling115

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]

10% popularity Vote Up Vote Down


 

@Si4351233

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

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme