-
Hi there,
We have noticed strange issues on our sitemap pages. Will you please check and let us know what is the issue and how that can be fixed?
Thank you!
-
Hello,
We apologize for the issues you are facing with your sitemap pages. There are several common problems that can occur with sitemaps, and we can guide you through some potential fixes:
-
Blank or White Page: If your sitemap shows a blank page, check the source code. If the source code is empty, there may be a conflict with another plugin or theme. You can use the Health Check plugin to identify the conflict. If there is data in the source code, try flushing the sitemaps cache and excluding it from caching plugins.

-
404 Error: If Google can’t access your sitemap, try flushing permalinks by going to the Permalinks page in your WordPress dashboard and clicking Save Changes.
-
Sitemap Blocked by robots.txt: Ensure there are no unintended rules in your robots.txt file that might be blocking access to your sitemap. You can check this in Rank Math SEO → General Settings → robots.txt.
-
Custom Canonicals: If you have added custom canonical URLs to your posts, they may not appear in the sitemap. Consider removing these custom canonicals to allow Rank Math to generate them correctly.
-
Unsupported File Format: Ensure your sitemap file has the correct XML header:
Also, check that you are using straight quotes for XML attributes.
-
Server Configuration Issues: If your sitemap is not working on Apache or Nginx servers, you may need to add specific rewrite rules to your server configuration files. For example, for Apache, you would add rules to your
.htaccessfile, and for Nginx, you would modify the Nginx config file.- For Apache:
# 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:
# 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
- For Apache:
For more detailed troubleshooting steps, you can refer to our guide on fixing sitemap issues.
If these suggestions do not resolve the issue, please reply to this ticket, and a human agent from the Rank Math Support team will take over and assist you further.
Thank you for raising this concern!
Sources:
Rank Math Sitemap Issues and Their Fixes » Rank MathHello,
The issue you are seeing is caused by an XML declaration error on your sitemap. This means that there is some extra content or whitespace before the XML declaration in your sitemap file. This can make your sitemap invalid and unreadable by search engines.
The most common reason for this error is a whitespace in your theme code, such as a blank line or space in your wp-config.php file or your theme’s functions.php file. This can happen when you edit these files manually or use a plugin or theme that modifies them.
To fix this error, you need to find and remove the whitespace from your theme code. You can follow this guide to troubleshoot and resolve this issue: https://rankmath.com/kb/fix-sitemap-issues/#xml-text-declaration
If the issue persists, you can also use this script to automatically fix this error: https://wejn.org/stuff/wejnswpwhitespacefix.php.html
Looking forward to helping you
Hello,
Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.
If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.
Thank you.
-
The ticket ‘Sitemap issues’ is closed to new replies.