We help IT Professionals succeed at work.
Get Started

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

Advoco
Advoco asked
on
468 Views
Last Modified: 2012-06-21
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?
Comment
Watch Question
Commented:
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE