Magento google sitemap generation for multistore installation

MagentoHello everyone,
if you ever need to have a sitemap for each store created under a single Magento installation, you will probably face a little error about the unavailability of your specified path for the creation of the sitemap.

Regardless of the path you may specify, you will get the following error all the time:

Path "mypath/mysitemap.xml" is not available and cannot be used.

As you can imagine the problem is not very clear as the error is misleading to a different source.

As today (Magento 1.6.x) the only way to avoid the problem, without touching core files that is, is to understand that Magento want a specific name for the sitemap, and it will not accept anything else:

sitemap.xml

However, to have more sitemap.xml, one for each storeview, you will need to manage sub-paths, like:

myrootfolder/sitemaps/mystoreview_[1,2,3...,n]/sitemap.xml

If you would like a clean approach you can, however, work with the rewrites to let the Apache serve a clean url for the sitemap:

RewriteCond %{HTTP_HOST} ^.*yourstore_1\.com$ 
RewriteRule ^sitemap.xml$ yourpath/sitemap.xml [NC]

Enjoy!

P.S.:

Also available in dutch!
http://www.byte.nl/blog/2012/08/10/sitemap-maken-in-een-multistore-magento/
http://www.dutchento.org/sitemap-maken-in-een-multistore-magento/#more-3555