Hello,
We apologize for the issue you are facing with the sitemap not working. Since you’ve already tried the suggested fixes from the article, we recommend checking a few additional things:
-
Flush Permalinks: Go to your WordPress admin area, navigate to Settings → Permalinks, and hit the “Save Changes” button. This can often resolve issues with sitemaps.
-
Check for Rewrite Rules: Ensure that your server has the correct rewrite rules in place. If you’re using an Apache server, you may need to add the following 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, you would need to add:
# 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
-
Check for Plugin Conflicts: Sometimes, other plugins can interfere with the sitemap functionality. You can use the Health Check plugin to identify any conflicts.
-
Validate Your Sitemap: Use a tool like Validate XML Sitemap to check if your sitemap is correctly configured.
If these steps do not resolve the issue, please reply to this ticket, and a human agent from our support team will take over and assist you further. Thank you for your patience!
Sources:
Why the Sitemap_Index.xml is Throwing a 404 Error » Rank Math
Troubleshooting the “Couldn’t Fetch” Error in Google Search Console » 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.
Here is the XML Validation – you can see there’s an issue in the header – XML Validation Issue – delight design
Hello,
The validation is due to the sitemap not working, so it will return that as HTML.
In this case, please disable the transient cache for the sitemap by applying this filter. This will make sure that your XML sitemap always reflects the latest changes on your site:
/**
* Filter if XML sitemap transient cache is enabled.
*
* @param boolean $unsigned Enable cache or not, defaults to true
*/
add_filter( 'rank_math/sitemap/enable_caching', '__return_false');
If you’re not sure how to add this code, you can follow this guide:
https://rankmath.com/kb/wordpress-hooks-actions-filters/
Also, head over to your website files /wp-content/uploads/rankmath/, and delete any XML files from that path.
If the issue persists, try updating the plugin to the beta version, as we have included a fix for sitemap caching issues.
Here’s a guide you can follow:
https://rankmath.com/kb/version-control/#beta-updates
Let us know how this goes.