Hello,
Thank you for contacting Rank Math, and sorry for any inconvenience caused.
Can you please follow these steps?
1. Flush the Sitemap cache by following this video screencast:
https://i.rankmath.com/pipRDp
2. Exclude the Sitemap files of the Rank Math plugin in your caching plugin. The cache could be via a plugin or from the server. For plugins or Cloudflare, please follow this article:
https://rankmath.com/kb/exclude-sitemaps-from-caching/
Also, add the NGINX rules again.
Once done, clear your browser cache, and resubmit the sitemap_index.xml in the Search Console.
That should fix the issue. Please let me know if that does not. We are here to assist.
Hi Anas!
Nice to meet you. I already did all the steps as they were mentioned in other threads but still no luck.
I’ve now disabled all other plugins, enabled the default theme and still no luck
The site is on https://staging.mailster.dev/
The sitemap is here: https://staging.mailster.dev/sitemap_index.xml
It’s reachable (no matter if the nginx code is added or not) but it also send a 404 header.
These are the lines I’ve changed in my nginx config:
location / {
try_files $uri $uri/ /index.php?$args;
}
after
location / {
rewrite ^/sitemap_index.xml$ /index.php?sitemap=1 last;
rewrite ^/([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;
try_files $uri $uri/ /index.php?$args;
}
Of course I’ve restarted the nginx service and even rebooted the server.
Any other idea?
Hello,
I checked your sitemap and it’s working fine.

Can you please clear your browser’s cache and try again?
Let us know how that goes. Looking forward to your update.
Thanks.
Hi,
It’s working yes, but it returns a 404 error. Please open the browser console or run
curl -LI https://staging.mailster.dev/sitemap_index.xml in you terminal.
Hello,
This is normal to see because the curl command tries to find the physical file and that doesn’t exist because all our sitemaps are dynamically generated on the fly when the page loads.
This method is also perfectly acceptable by Google and other Search Engines and they can crawl the sitemaps fine.
Hope this helps clarify your doubts.
Don’t hesitate to get in touch if you have any other questions.
Hi
Just to clear this up:
My server needed a restart and only restarting the nginx service didn’t work (in my case). So if anyone has a similar problem just try to restart the server after adding the rules to the nginx config file.
Cheers
Hello,
We are super happy that your issue is resolved and thanks for sharing the solution here with us. If you have any other questions in the future, know that we are here to help you.
If you don’t mind me asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post about your overall experience with Rank Math? We appreciate your time and patience.
If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.
Thank you.