Reputation: 2530
I have created a site, that uses 1 code base, but multiple domains access that codebase. Now the content served-up shows different CSS and imagery.
My question i'm running into, is, how do I generate a Sitemap file for each domain. I have looked at using, http://www.xml-sitemaps.com/ and using their Script, but that will only work for 1 domain.
Other than creating my own code to do the site scraping, I don't see any other route. Do you know of another solution instead of having to start from scratch? Ideally would love to hit the ground running.
Note: The script needs to crawl the site. Thoughts?
Upvotes: 1
Views: 550
Reputation: 5238
Assumptions built into this answer:
The URI elements trailing the domain name are the same on each domain, for all pages.
i.e. http://site-one.com/page/1
is the same as http://site-two.com/page/1
You are able to manipulate the file provided by xml-sitemaps. This is a concern if you need to generate this on a continuous basis, meaning you would need to create a script to do the following per href.
If you don't mind using the service you mentioned at http://www.xml-sitemaps.com and , then by far the easiest way to do this would be to use that service and then change all absolute URLs to relative URLs. You can write any link that looks like
http://www.example.com/category/page
as a relative link at
/category/page
In short, that starting slash is the key, indicating to the browser to 'use the current domain'. You can do a find and replace on all all instances of http://www.example.com/
, converting to /
+ the remaining string of URI elements.
Upvotes: 1
Reputation: 7918
Creating Mutliple sitemaps for single codebase something challanging job but not the impossible one. I am supposing that you are using some kind of framework for working of website.
Theer are many problem which comes during creating such thing are:
How to identify which request is coming from which website. So, the problem is to create the sitemap for specific site for the request is recieved.
Somehow, if you identify the which request is coming from which website then your website is dynamic. How to record these paramenters.
Where to store the such a huge database. Somehow if you resolve these things the mutlitple sites requests/parameters which database would be large enough to store such large requests.
If you somehow manage the huge database then next problem about submitting such a huge xml to search engine.
Sitemap would start growing daily the time for creation would certainly go up and so the request of crawling from website would also grow daily.
If your sitemap grows huge and same pages are submitted for different website then content would be marked as spam along with website.
There are some problems which can be unseen or predicted and thus it will be risky thing. Now to do it.
For problem 1st and 2nd we have to use the PHP $_SERVER
- which provides the information about Server and execution environment information, such as parameters, hostname, requested host and many other things.
Now for problem 3 to 6, we have use the text files to store the requests one file for one domain and provide request details. The file must be flushed after particular time i.e. daily, weekly etc.
While creating sitemap we have to read the file and get the unqiue parameters, so that the sitemap doesn't include multiple same urls.
warning: It is highly recommended that don't do such thing as it will trigger the spamming and would be identified soon and marked as spammers websites.
Upvotes: 1