How to fix sitemap_index.xml with WordPress SEO Plugin by Yoast

by in Wordpress.

When using WordPress for your content marketing, you want to make sure that your content is optimized for search engine ranking. A great tool to do this is the WordPress SEO Plugin by YOAST.

We had an issue with this plugin where we got a 404 error when accessing sitemap_index.xml generated by the WordPress SEO Plugin by Yoast. We also use the WP Super Cache plugin on our blog.

Here is how we fixed the issue:

Exclude sitemap files from caching

  1. In your WP admin go to Settings/WP Super Cache.
  2. Go to the “Advanced” tab.
  3. Add this string that forces a page not to be cached:
    sitemap(_index|[0-9]+)?.xml
  4. Clear your cache for the changes to take effect.

Re-save the WP permalink settings

  1. In your WP admin go to Settings/Permalinks.
  2. Without making any changes, submit the form.

I assume that saving permalink settings somehow triggers a missing initialization step for the sitemap plugin.