Blog

Split large xml sitemaps PHP script

Many people will be familiar with the popular Google (XML) Sitemaps Generator for WordPress I use it on all of my wordpress installs and have been very happy with it. Until about a month ago when I was installing it over at accommodationsphere.com and it created a sitemap for me nicely gzipped and weighing in at only 1-2mbs but a whopping 92,000 urls.

Does google accept sitemaps with that many files? Not unless they’re split across multiple sitemaps which contain less than 50,000 urls each and utilize a sitemap index file.

So I organized a nice little php script that I’ve got loaded in a cron job that runs to split that large sitemap.xml.gz file into smaller .xml.gz files and creates an index file.

It’s a little crude but I’m hoping to get this included as a feature in the above mentioned plugin rather than expanding on this little scripts abilities outright.

You’re free to use it, modify it and do what ever, but be nice; if you develop a bit of extra features or usability for it why not send me the code for inclusion in the next version.

Download PHP XML Sitemap Splitter Version 1.0

Downloaded a total of 162 times

One comments

This is a great concept, and I have used it on one of my sites now - successfully. It would be great if this was made into an easier process though, like a plugin that automatically split the sitemap upon creation when a new post is made. Has anyone done this or expanded upon your original script?

Leave a Reply

Simpler Computing - Wordpress Plugins - Help Desk Plugin
Simpler Computing - Wordpress Plugins - Help Desk Plugin