Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Do XML sitemap files have to end with the .xml file extension?

On the Bigcommerce platform, their XML sitemap file are defined as:

http://www.examplesite.com/xmlsitemap.php

The sitemap file is all correctly marked up and and when saving locally its saves as an .xml file. I've also seen some Joomla sitemap plugins create sitemaps with .php extensions.

The Sitemap Protocol site doesn't cover this.

I unfortunately don't have access to GWT too see if it verifies.

share|improve this question
add comment

2 Answers 2

It has been verified that a PHP file can be used as a sitemap file such as sitemap.php

  1. I checked http://sitemaps.org (the website with the specification information for sitemaps) and there is no mention that the file must be saved in the .XML format. I will have to say that yes, it will work, as long as Google does not have a problem with the extension for some reason.

  2. When you go through Google Webmasters Tools and click on submit/test a sitemap you are prompted with your site's root directory http://example.com/ immediately followed by a text field you can enter any file name and extension into; with no file extension forcing you to use an actual "XML" file here I'm assuming that you can use a sitemap with a .PHP extension.

share|improve this answer
2  
I can confirm that works, I had to a dynamic sitemap once and ended up writing a php script to generate the xml. Have tried this with GWT and BWT both. –  Prasad Jun 14 '13 at 6:52
    
But does it need to be served with an XML mime type i.e. text/xml? –  DisgruntledGoat Jun 15 '13 at 17:18
add comment

I gzip my sitemap to mymap.xml.gz and it works fine when I declare it so in my robots.txt. If you have a Google Webmaster Tools (GWT) account, GWT will tell you if there is any issue with your sitemap.

So, no, the extension does not have to be .xml.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.