Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Does it matter if I serve sitemap.xml as a dynamic page? e.g., use .htaccess to rewrite sitemap.xml (or whatever static URL I submitted at the Webmaster Tools) to a PHP file. The PHP file will call the DB and generate the XML file on the fly.

Does it matter if I use it like this a dynamic PHP page, or should I prepare a static page? The only downside I see is the load time of the file, but it doesn't sound too important considering this page is accessed only by SE boots.


share|improve this question
up vote 12 down vote accepted

No, it doesn't matter, and it's actually a pretty good idea if you have regularly added content. It makes no difference to Google whether you wrote the file by hand, generated it manually with an online tool, generated it automatically with a cronjob, or generated it live each time the sitemap is requested.

As danlefree suggests, you ought to consider caching in the case of large sites. (I would personally use some form of caching if your sitemap is over 200 entries. You can probably safely generate a sitemap with 100-200 pages without putting much load on the server.) If you're already using memcached, then you'll be good.

I'm not sure how often Google hits a sitemap, but you might also consider refreshing it every time Google hits it, but simply serving up the cached copy when its another host.

share|improve this answer
"it doesn't matter" - Providing your host server has resources to spare, this is true - you might want to consider caching the output of your script if you start seeing performance degradation (i.e. "what happens when there are 10k entries in that sitemap?") though. – danlefree Nov 18 '10 at 1:16
Good point, I was going to mention caching, but it seemed like an implementation issue. I'll add that though/ – Lèse majesté Nov 18 '10 at 2:51

The search engines only see the xml you produce. They do not see the programming language you use.

share|improve this answer
Sure thing, just wondering if they give any importance to the load time of sitemap.xml file – Joel Nov 17 '10 at 23:53
Nope. Page speed only affects web documents Google indexes and even then it only matters if your page is really slow. Like bottom 1% slow. But naturally you want to make sure the file doesn't timeout as that will cause problems. But unless the code is poorly written you shouldn't have any issues as every web based server side programming language is fast enough to do this quickly and easily. – John Conde Nov 18 '10 at 0:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.