-
Hello,
I’ve followed all instructions to fix the sitemap error in your help section. RankMath is still breaking the sitemap.xml file.
-
Hello,
We apologize for the issue you are facing with your sitemap.xml file. It can be frustrating when things don’t work as expected. Since you’ve already followed the instructions in our help section, here are a few additional steps you can take to troubleshoot the problem:
-
Validate Your Sitemap: Use the Validate XML Sitemap tool to check if your sitemap is correctly configured. This can help identify any issues.
-
Check Sitemap Location: Ensure that your sitemap is located in the root folder of your WordPress installation. The URL should look like this:
https://yourdomainname.com/sitemap_index.xml
. -
Flush Permalinks: If you are getting a 404 error, try flushing your permalinks by going to the Permalinks settings in your WordPress dashboard and clicking Save Changes without making any changes.
-
Check for Plugin Conflicts: Sometimes, other plugins can conflict with Rank Math. You can use the Health Check plugin to identify any potential conflicts.
-
Server Configuration: If you are using Apache or Nginx, ensure that the appropriate rewrite rules are added to your
.htaccess
or Nginx config file as mentioned in our documentation.- 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:
If these steps 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 your patience!
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.
As in the description, I’ve followed these instructions and the plugin is still breaking the sitemap.
Hello,
Thank you for contacting support.
There are two potential reasons for this.
1. You have a space before the opening PHP tag in one of the files that is being loaded into the website. Most of the time, that issue happens in the
wp-config.php
orfunctions.php
file.2. You have a closing PHP tag on a file that doesn’t need it so the headers are sent twice. This is much difficult to track because it could be happening on any PHP file on the installation and that includes the theme and plugins installed.
The easiest way to get around this immediately is by applying the following patch: https://wejn.org/stuff/wejnswpwhitespacefix.php.html
Don’t hesitate to get in touch if you have any other questions.
-
You must be logged in to reply to this ticket.