Hello @lashac,
Thank you for contacting Rank Math support.
The code only needs to be used if your sitemap is not working. Please visit the sitemap URL, and if it loads without any issues, you can dismiss or ignore the notification. If the sitemap doesn’t load, then you should get in touch with your host and ask them to add the code to your server configuration file.
Let us know how that goes. Looking forward to helping you.
Thread Starter
Lasha
(@lashac)
However, search console sees it, fetches but several days later, it can’t fetch it.
Also, it’s weird but I have another website on the same server and it has no issues.
Hello @lashac,
In that case, you can simply ignore this message as the sitemaps are already loading fine.
Thank you.
Hello @lashac,
This could be related to the cache. We recommend following this guide to exclude your sitemap from caching: https://rankmath.com/kb/exclude-sitemaps-from-caching/
You should also add the following filter to your site to disable server-side cache for sitemap: https://rankmath.com/kb/exclude-sitemaps-from-caching/#transient-cache
Here is how to add a filter to your site: https://rankmath.com/kb/wordpress-hooks-actions-filters/
If you still face the Couldn’t Fetch error, please share the sitemap URL and a screenshot of the detailed error in your GSC account.
Looking forward to helping you.
Thread Starter
Lasha
(@lashac)
@rankmathsupport I will try it but I only use varnish cache on server and it’s enabled on both websites but only one has the sitemap issue.
Hello @lashac,
Please add the filter and exclude the sitemap from your caching plugin. You shouldn’t face the couldn’t fetch issue after that.
Let us know how that goes. Looking forward to helping you.
Thread Starter
Lasha
(@lashac)
I excluded sitemaps from cache and will wait for the results.
Hello @lashac,
Sure! Let us know how it goes.
Meanwhile, please don’t hesitate to let us know if you have any other questions.
Looking forward to helping you.
Thank you.