Mobile app version of vmapp.org
Login or Join
Speyer207

: Can a sitemap index file list sitemaps in a different directory? If I have a sitemap index, can the sitemaps listed in the index be located in a subdirectory, but have links that isn't specific

@Speyer207

Posted in: #Seo #Sitemap #XmlSitemap

If I have a sitemap index, can the sitemaps listed in the index be located in a subdirectory, but have links that isn't specific to the subdirectory? I'm trying to avoid having multiple sitemaps in the root directory of my server, if I can help it.

/Sitemap.xml

<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>http://www.example.com/assets/cnt/sitemap/main.xml</loc>
</sitemap>
</sitemapindex>


/assets/cnt/sitemap/main.xml

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>http://www.example.com/</loc>
<changefreq>daily</changefreq>
</url>

<url>
<loc>http://www.example.com/Customer-Service</loc>
</url>
</urlset>


I posted a similar question earlier, but I did not explain myself clearly.

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Speyer207

2 Comments

Sorted by latest first Latest Oldest Best

 

@Cofer257

According to the "spec" that w3d mentions, sitemap files cannot reference URLs in alternate directories.

However, this is simply not true for all the search engines. I have put sitemap files in a subdirectory and never had a single error in Google or Bing Webmaster Tools.

So in practice it makes no difference where you put sitemaps.

10% popularity Vote Up Vote Down


 

@Ann8826881

Although the sitemap index file can list sitemaps in a different directory, the sitemap files themselves cannot reference URLs that are outside of the directory tree/subdirectory in which they are located - which I believe is what you are asking in the second part of your question. So, no, in answer to your overhaul question, I don't think you can. EDIT: At least according to the sitemap spec.

The only criteria with referencing sitemap files from the index is that the sitemap files are on the same domain. (By the way, the sitemap index file should have <sitemapindex> as its root element, not <urlset> as in your "Sitemap.xml" example - these are for ordinary sitemap files.)


Note: A Sitemap index file can only specify Sitemaps that are found on
the same site as the Sitemap index file. For example,
www.yoursite.com/sitemap_index.xml can include Sitemaps on
www.yoursite.com but not on www.example.com or
yourhost.yoursite.com.
Ref: Using Sitemap index files (to group multiple sitemap files)


However, according to the sitemap protocol, the sitemap files themselves cannot reference URLs in a parent directory, or a directory outside of the subdirectory (as I think you are implying in the 2nd part of your question), as it is deemed that the creator of the sitemap in one location might not have permission to access URLs in an entirely different subdirectory.


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

Ref: Sitemap file location


EDIT:

This is my interpretation of the official sitemap protocol specification. However, implementation would seem to suggest otherwise - see @DisgruntledGoat 's answer, but also take note of comments regarding robots.txt.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme