Mobile app version of vmapp.org
Login or Join
Margaret670

: Does sitemap.xml have to be in the root directory? This may be a simple and absurd question, but is it completely necessary for sitemap.xml file to be in the root directory of the wordpress

@Margaret670

Posted in: #Seo #Sitemap

This may be a simple and absurd question, but is it completely necessary for sitemap.xml file to be in the root directory of the wordpress install directory of the site, or is it ok to create a subdirectory and place it there? i.e. /sitemap/sitemap.xml

I've created a dynamically generated site map xml file, but would like to auto-generate it on the fly when changes are made, and need to be able to write to this file. I would like to keep the main wordpress folder permissions as they are and only have this subdirectory writable.

Would love to hear any thoughts on the matter! Or alternate solutions... Merci!

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Margaret670

1 Comments

Sorted by latest first Latest Oldest Best

 

@Turnbaugh106

Yes and No. From the sitemap.org official site:-


The location of a Sitemap file determines the set of URLs that can be
included in that Sitemap. A Sitemap file located at
example.com/catalog/sitemap.xml can include any URLs starting
with example.com/catalog/ but can not include URLs starting
with example.com/images/.

So yes, you can locate it outside the root, but doing so does limit the url set you can include if you correctly observe the protocol.

You can inform Google and Bing of your sitemap's location via their webmaster tools interface, but I can't say if they actually care about the URL set when sitemap.xml is not located in the root. IMHO I would observe the protocol.

Full details www.sitemaps.org/protocol.html#location
Since you're using wordpress, there are many plugins which can do the job for you, I recommend Google (XML) Sitemaps Generator for WordPress (which supports custom post types, be careful when selecting alternative plugins as many others don't support this feature).

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme