Website Design Blog

Website Design Blog

11-9-2009 - Posted in SEO,Web Design

If you are like me you probably have a ton of clients who regularly need their sitemap.xml updated. It's gotten to be more of a task everytime I acquire a new client. To simplify matters and save myself a bucket load of time I've developed a simple sitemap.xml which auto generates by reading everyfile from your website. So if you add a new file, it'll automatically show up.

You can download it here: sitemap.zip

It's very simple. I allowed PHP to run within .xml files and use PHP to read the directory it's housed in on the fly and output an xml sitemap based on what it finds. It'll read .php, .html and .htm file extentions. Viewing source you can easily modify it to include any other file types.

In order to get this to work you'll need to use an .htaccess file to allow PHP to run within a .xml file. It's simple to do but each each host does it differently. If you are unsure how to do this check with your provider and they'll get you setup. Here's how mine works.

AddHandler application/x-httpd-php5 .xml

Let me know if you have any problems or suggestions to make this better.

Now with your extra time you can finally go play legos like you've been dreaming of.

Back

Leave a Comment

Leave a Comment

Name

Email (required but never shared)

Website e.g. - http://www.yoursite.com

Comment

Are You Human? Please enter the text as you see it in the image below

Comments for Self Updating XML Sitemap

Zack - 11/13/2009
Wow, great little script! Thanks!

Danno - 2/23/2010
YAY! Time for legos!

Ninja - 3/8/2010
Thanks for this, can you just confirm :-
if no .htaccess file then make one and add

AddHandler application/x-httpd-php5 .xml

then overwrite the current sitemap.xml with yours and next time google wants the sitemap it will auto generate it ?

What do you need to get your website online?

What do you need to get your website online?

Subscribe

Subscribe Freelance Web Designer
Subscribe to the Freelance Web Designer Blog RSS Feed
Follow Freelance Web Designer on Twitter

Blog Categories

Freelance Web Designer Blog Categories