17

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!

0

1 Answer 1

17

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 http://example.com/catalog/sitemap.xml can include any URLs starting with http://example.com/catalog/ but can not include URLs starting with http://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 http://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).

11
  • @Starfs what's the issue you're having, I run about 30 Wordpress sites and have never had an issue with root security settings and the sitemap... Commented May 10, 2012 at 16:45
  • 1
    FYI both Google and Bing allow any URLs in a sitemap, not just those below the current folder. Also, I'm sure this is a dupe question. Commented May 11, 2012 at 0:37
  • 1
    @DisgruntledGoat I'm pretty sure both do, but I can't find any documentation from either that supports that notion, so I stuck with the spec in the answer. Commented May 11, 2012 at 3:27
  • 1
    Here is my documentation: webmasters.stackexchange.com/a/23933/233 (i.e. personal experience) Commented May 11, 2012 at 14:21
  • 3
    For Google: If you submit the Sitemap-URL via robots.txt, you can place it anywhere (even on other sites). If you submit via Google Webmaster Tools, the Sitemap can be anywhere within any verified site (so in subdirectories of a verified site, or on other domains). Source: Help Center & blog posts Commented May 15, 2012 at 18:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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