The sitemap error “Couldn’t Fetch” that you might come across is most likely a bug with Google Search Console.
If you happen to encounter this issue on one of your websites, then the following steps we discuss in this knowledgebase article can help you get rid of it.
1 Configure Your Sitemap
First, you need to ensure that you have configured the sitemaps correctly. To do so, please refer to this Rank Math Sitemap configuration tutorial. Upon completion, you can validate your sitemap here: Validate XML Sitemap.
2 Fix Sitemap Issues
If the sitemap is blank, then you have to make sure that posts/pages/CPTs/Terms exist and are indexable. Content that has been set to no-index is not included in the sitemaps.
Some other sitemap-related issues and their fixes discussed in this KB would be helpful if the sitemaps are not loading correctly in the browser and getting errors on the testing tool.
You can check if your content is indexable from the Rank Math > Titles & Meta.
To check if an individual page/post is indexed or not, go to the post/page, and then in the Advanced tab of Rank Math SEO, you will find the index checkbox. In order to index your post/page, mark the checkbox selected.
3 Flush the Cache
If it looks like your sitemap is outdated, you need to flush the sitemap cache. To do so, simply navigate to Rank Math > Sitemap Settings.
In this field, increment the Links Per Sitemap and then save your settings by clicking the Save Changes button at the bottom of the page.
And then navigate to your site’s settings for permalinks – located under Settings > Permalinks and then simply save the changes to ensure the current settings have been properly applied.
4 Exclude the Sitemap from Caching
Refer to the following knowledgebase article to ensure that your sitemaps are excluded from caching.
5 Check for the Correct Version of the Sitemap
You need to ensure that only one version of the sitemap is available. There is a possibility that there are different versions of your website that are viewable in the browser.
5.1 Check URL Set in WordPress General Settings
a) Ensure that the correct version of your sitemap is submitted to Google. You can check your site settings at WordPress Dashboard > Settings > General.
Sometimes, there are chances that you have the
https://domain.com version on your website but submit the
http://domain version to Google. Sometimes, www. is prefixed on the website but not to the sitemap URL submitted to Google.
5.2 Ensure Sitemap Is Accessible
Enter all 4 variations of the sitemap in httpstatus.io and check the results.
Only one of the 4 variations should show a 200 status code. The 3 remaining ones should show 301.
5.3 Decide Which Version (www vs. non-www) You Want to Use
To check which version you should choose (if you don’t know already and have an existing site), running the following search (for your own site, of course) can be useful:
Then, check which variation of the domain opens:
This is the version you should likely choose, but it depends on your preference as well, and more than anything else, you need to be consistent.
5.4 Redirect All Three Other Versions to Your Preferred Variation
You need to ensure that the other 3 variations are all redirected to the 4th and final chosen/preferred one. This can be done using both the .htaccess and Nginx methods.
You can read this tutorial of the .htacess method that will help you to redirect non-www to www URLs using the .htaccess file in your public_html folder. Also, you can go through the Nginx method that will help you redirect from the www to non-www variation of your website with Nginx.
6 Rename the Sitemap File
According to John Mueller, if the Sitemaps are valid and still aren’t functioning or couldn’t be read, then changing the name of the Sitemap file can do the magic.
In order to rename the file, you can submit
https://domain.com/?sitemap=1 URL instead of the
sitemap_index.xml and it will do the same job as that of renaming the sitemap file.
And, that’s it! We hope the above steps have helped you resolve the issue. If you’re still facing the issue or if you have any other questions, please feel free to reach our support team directly from here, and we’re always here to help.