Hello,
We apologize for the issue you are facing with your sitemap. A 404 error when accessing your sitemap can often be resolved by flushing your permalinks. Here’s how you can do that:
- Go to your WordPress admin area.
- Navigate to Settings → Permalinks.
- Click the Save Changes button, even if you didn’t make any changes on the page.

This should help resolve the 404 error. If the issue persists, please check if your server is configured correctly to handle the sitemap. You may need to add rewrite rules to your .htaccess file if you are using an Apache server or your Nginx configuration file if you are using Nginx.
For Apache, add the following code to your .htaccess file:
# START of Rank Math Sitemap Rewrite Rules
RewriteEngine On
RewriteBase /
RewriteRule ^sitemap_index.xml$ /index.php?sitemap=1 [L]
RewriteRule ^([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 [L]
RewriteRule ^([a-z]+)?-?sitemap.xsl$ /index.php?xsl=$1 [L]
# END of Rank Math Sitemap Rewrite Rules
For Nginx, add the following code to your configuration file:
# START Nginx Rewrites for Rank Math Sitemaps
rewrite ^/sitemap_index.xml$ /index.php?sitemap=1 last;
rewrite ^/([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;
rewrite ^/([a-z]+)?-sitemap.xsl$ /index.php?xsl=$1 last;
# END Nginx Rewrites for Rank Math Sitemaps
If you continue to experience issues, please reply to this ticket with any relevant details or access permissions needed for us to assist you further. A human agent from our support team will take over and provide more specific guidance.
Thank you for raising this concern, and we look forward to helping you resolve it!
Sources:
Rank Math Sitemap Issues and Their Fixes » Rank Math
This is an automated reply from Rank Math Support Bot. Your ticket has been assigned to a human agent and we will get back to you shortly.
Hello,
You seemed to have marked this ticket as resolved.
We’re just following up with you to see if you have any other questions or concerns that we can assist you with. Or, if your issue has been resolved, please let us know so we can mark this ticket as closed.
Thank you for choosing Rank Math.
I got here through a Google search for how to fix the same error. And saving the permalinks worked for me. Thanks for the help.
Hello @ardiueredeu,
Thank you for reaching out to us and for sharing your solution.
If saving the permalink settings resolves the issue, this indicates heavy caching on your sitemap, and this issue could happen again in the future.
In this case, you can follow the steps below to ensure your sitemap is free from caching:
#1 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/
#2 Apply the following filter code to your site.
add_filter( 'rank_math/sitemap/enable_caching', '__return_false');
Here’s how you can add filter to your WordPress site:https://rankmath.com/kb/wordpress-hooks-actions-filters/
Hope that helps.