Back to top
Copyright 2005 - 2024 - AlfredFox.com - Freelance Website Design

Self Updating XML Sitemap

Posted on: November 9th, 2009 by afox

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 every time 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.



Comments are closed.