Can a sitemap file have different extension instead of .xml
by Manigandan[ Edit ] 2011-09-16 16:13:17
Yes,it can have.
You can use every file name with your sitemap. Google accepts what you submit, 'sitemap.xml' is just a default. So you can go for 'sitemap.php', 'sitemap.asp', 'mysitemap.xhtml' or whatever scripting language you prefer, as long as the content is valid XML. However, there are good reasons to stick with the default 'sitemap.xml'.
Here is an example for Apache/PHP:
Configure your webserver to parse .xml files for PHP, e.g. by adding this statement to your root's .htaccess file:
AddType application/x-httpd-php .htm .xml .rss
Now you can use PHP in all .php, .htm, .xml and .rss files. http://www.yourdomain.com/sitemap.xml behaves like any other PHP script. Note: static XML files will produce a PHP error caused by the XML version header