Dynamic sitemap creation depending on domain suffix & directing robots.txt

Advoco used Ask the Experts™
Hi all.....

I have a hosted site but with two domain names pointing to it with basically the difference being that one is a ".com" and the other a ".ie".

So I'm trying to think of a way to create a sitemap for each domain and have robots.txt point to correct sitemap depending upon which domain was used to access the site:

mysite.ie -> robots.txt -> sitemap: http://www.mysite.ie/iesitemap.xml
mysite.com -> robots.txt -> sitemap: http://www.mysite.com/comsitemap.xml 

Any ideas?

My current thinking is something like creating the sitemap on the fly when robots.txt directs the crawler:

mysite.ie -> robots.txt -> sitemap: http://www.mysite.ie/sitemapbuilder.php
mysite.com -> robots.txt -> sitemap: http://www.mysite.com/sitemapbuilder.php 

Where sitemapbuilder.php will build the sitemap on demand, putting in the domain suffix as required (".ie" or ".com"). The output of sitemapbuilder.php would then be identical xml to that of a sitemap.xml file.

Would that work? I have no idea tbh. Next question.... if it does work, in Google Webmaster Tools could I just link to the sitemapbuilder.php file or is it strictly a *.xml file?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

I would never recommend to any one set up multiple sites (copies), it's pointless, useless and bad. I would recommend you to do "301 redirect".

If you do redirect you need only one robots.txt and one sitemap.
As you know sitemap is used by crawler to locate your pages, so if your website doesn't have pages within pages within pages, you don't need to worry about sitemap.

You can try to check whether all pages can be found by crawler use this website http://www.xml-sitemaps.com/ , if it can locate all pages than there is no need to have sitemap, because search engine can find all pages as well.  


OK, solved it.


Solved the problem myself

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial