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

2 Answers 2


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.

  • 1
    "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
    Commented Nov 18, 2010 at 1:16
  • Good point, I was going to mention caching, but it seemed like an implementation issue. I'll add that though/ Commented Nov 18, 2010 at 2:51

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

  • Sure thing, just wondering if they give any importance to the load time of sitemap.xml file
    – Joel
    Commented Nov 17, 2010 at 23:53
  • 1
    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
    Commented Nov 18, 2010 at 0:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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