By default, XML sitemaps generated by the WordPress SEO plugin are named as sitemap_index.xml
. But, by default, sitemaps are named as sitemap.xml
. If your WordPress blog is running on Nginx and if you are using the Yoast WordPress SEO plugin, there is a way to access the sitemaps using either /sitemap_index.xml
or /sitemap.xml
.
WordPress SEO will provide two rewrite rules if you are running on Nginx. A third rule is required to load the XML stylesheet. More information on this is available here. Another fourth rule is required to fetch the XML sitemap from “/sitemap.xml
“.
1 |
rewrite ^/sitemap\.xml$ /index.php?sitemap=1 last; |
Once the above rule has been added to Nginx, the XML sitemaps can be accessed using either /sitemap_index.xml
or /sitemap.xml
.