In this knowledgebase article, we’re going to walk you through why the sitemap_index.xml throws a 404 error and how to solve this issue.
Why the Sitemap_index.xml Throws a 404 Error?
A 404 error basically means that the sitemap index or individual sitemap does not exist. Google bot expects a result of 200 ok responses & fetches all your website URLs via submitted sitemap file. Instead, it throws a 404 error when it cannot locate the sitemap_index.xml.
Configuring sitemaps in Rank Math is extremely simple. However, if you’re not able to use the sitemap functionality in Rank Math, please go through our knowledgebase article on Rank Math sitemap issues and their fixes that’ll help you to fix some of the common sitemap problems.
How to Fix
sitemap_index.xml Throws a 404 Error in Rank Math?
If Rank Math doesn’t create a sitemap file or gets a 404 error while trying to access your sitemap index, you may have to flush permalinks or exclude the sitemap files from being cached. Please don’t be scared; it is fairly easy to do so. Let’s have a close look at how to fix this issue in Rank Math.
1 Flush the Sitemap Cache
To begin with, navigate to Rank Math > Sitemap Settings and change the Links Per Sitemap as shown below:
Click on Save Changes located at the bottom of the page. Once you’ve saved the settings, head over to your WordPress admin area and navigate to Settings > Permalinks as shown below:
Simply hit the Save Changes button once, even if you didn’t make any changes on the page.
This will flush the permalinks setting and fix your sitemap problem.
2 Exclude the Sitemap Files in the Caching Plugin
Using caching plugins is probably the easiest way to speed up your WordPress site. However, you might end up getting your sitemap cached too, and this is definitely not a good idea! A sitemap should always reflect the latest posts and URLs of your website; caching it defeats the purpose.
Since you don’t have to cache the sitemaps, exclude the sitemap files generated by Rank Math plugin from being cached in your caching plugin. The cache could be via a plugin or from the server.
And, that’s it! Now open the sitemap after clearing your browser’s cache or using a private (incognito) window, and you should see your sitemap without any trouble. If you still see a 404 error, please feel free to open a support ticket, and our support expert will be more than happy to help you out.