The Sitemap has certain limitations. For example, it cannot contain more than 50 000 URLs and cannot be bigger than 50 MB. This is why if you plan to create a website with multiple subdirectories and Sitemaps, you will have to use Sitemap Index.
The Sitemap index allows you to include several Sitemap files under one file called Sitemap index. It uses almost the same syntax but instead of including your pages URLs, you will have to add the URLs to your Sitemaps.
Below, you can find a sample code of a Sitemap index.
<?xml version="1.0" encoding="UTF-8"?>
As you can see the Sitemap index file uses the following XML tags:
The <loc> and the <lasmod> tags are basically the same as in the normal Sitemap file. The <sitemap> tag encapsulates information about an individual Sitemap. The <sitemapindex> tag provides information about all of the Sitemaps in the file.Be advised that the Sitemap files can be only files located under the same domain or subdomain and should be UTF-8 encoded as well.
It is strongly recommended that you place your Sitemap into the root directory of your web server. The location of a Sitemap file determines the set of URLs that can be included in it. A Sitemap file, for example, located under a subdirectory can include links of all pages in this subdirectory, but not ones above it.