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

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!

share|improve this question

migrated from wordpress.stackexchange.com May 10 '12 at 15:57

This question came from our site for WordPress developers and administrators.

    
Close-voted as off-topic. This question is entirely independent from WordPress. –  Chip Bennett May 10 '12 at 15:33
    
@ChipBennett Sorry, but seo and sitemap tags allowed. For example I want too to listen another opinion of community –  wikicms May 10 '12 at 15:47
    
If answer is near with WordPress of course ) –  wikicms May 10 '12 at 15:56
    
thanks for re-directing me to this site. I thought it was relevant to wordpress developers but this seems better! –  Starfs May 10 '12 at 16:28
add comment

1 Answer 1

up vote 7 down vote accepted

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).

share|improve this answer
    
That is what I was afraid of. Thanks for the quick response! –  Starfs May 10 '12 at 16:32
    
@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... –  toomanyairmiles May 10 '12 at 16:45
    
@Starfs and if you're satisfied with the response, please accept the answer. –  toomanyairmiles May 10 '12 at 16:46
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. –  DisgruntledGoat May 11 '12 at 0:37
1  
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 –  John Mueller May 15 '12 at 18:47
show 9 more comments

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.