Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use Google sitemap.php instead of .xml?

Tags:

php

xml

sitemap

I've written a script in PHP that generates a XML sitemap. It has a text/xml header and outputs a XML structure. Can I upload this sitemap.php file to Google or is it required to have a .xml extension?

like image 501
Tamara Avatar asked Nov 03 '22 16:11

Tamara


1 Answers

Check out http://www.sitemaps.org/.

All rules are defined here.

Exemplary see:

  • http://www.sitemaps.org/faq.html#faq_sitemap_location
  • http://www.sitemaps.org/protocol.html#informing

All you need is an URL, then announce that URL as your sitemap.

There is no .xml requirement in the protocol itself.

It's common to place it at the root as http://example.com/sitemap.xml, but read the reference documentation for all details, you're not required to, there can be good reason to not do so and the location of the sitemap file has implications about it's contents. So better read and chew a bit on it to find the best solution for what you're trying to do.

like image 129
shail Avatar answered Nov 12 '22 23:11

shail