Rank Math WordPress Plugin Duplicate Sitemap Bug
The popular WordPress SEO plugin, Rank Math, has been found to have a bug that causes it to generate duplicate sitemap files. This weird bug in the way sitemaps are generated is similar to the one affecting Yoast, but the way Rank Math handles it is different.
A sitemap is an important part of search engine optimization. It tells search engines which pages have recently been added to a site and which pages have been updated.
The sitemap helps a search engine prioritize the crawling of its website by alerting it to new content that needs to be indexed.
Due to the importance of a sitemap for SEO, it is recommended that sitemaps are generated correctly.
from google developer page about sitemaps says:
“A Sitemap is a file where you provide information about your site’s pages, videos, and other files, and the relationships between them.
Search engines like Google read this file to crawl your site more efficiently.
A sitemap tells Google which pages and files are important to you on your site, and also provides valuable information about those files. For example, when the page was last updated and any other language versions of the page. »
Rank Math XML Sitemap Bug
Rank Math also generates several XML sitemaps. In fact, it eventually generates an infinite number of XML sitemaps.
For example, a site with a single sitemap for “posts” will generate the following duplicate sitemaps:
But this will not generate the variant numbered zero, /post-sitemap0.xml
The same goes for duplicate sitemaps generated for pages:
And again, just like with “posts” sitemaps, Rank Math does do not generate the numbered sitemap variant: /page-sitemap0.xml
Rank Math generates an infinite number of sitemaps?
Although Rank Math does not generate the numbered zero sitemap variant, Rank Math generates what seems like an almost endless amount of numbered XML sitemaps.
Ideally, Rank Math should generate a 404 response code for sitemaps that don’t exist.
But what seems to be happening is that instead of generating a 404 response message, Rank Math generates a 200 response code (meaning it’s a valid webpage request), then generates an empty XML sitemap.
Here’s a URL I tested to see what Rank Math generated:
Here is what Rank Math shows:
Non-existent sitemap generated by Rank Math
How many sitemaps will Rank Math generate?
Apparently Rank Math can generate many URLs, possibly an infinite amount of XML sitemap pages.
I was able to generate a blank sitemap with this URL:
What’s interesting about the sitemap above is that the server generates a 200 header response code to a browser when serving this XML sitemap.
The 200 response code means there is no error.
I checked if Rank Math generated a 200 response code via the Website HTTPStatus.
This shows that Rank Math generates a 200 response code for pages that don’t exist:
Rank Math Sitemap Redirect Behavior
Other SEO plugins have a bug that creates a duplicate sitemap when the number zero is added to the end of a sitemap URL.
Rank Math does not, however, create a duplicate sitemap with the number zero.
When you make a request for the nonexistent number zero sitemap, the request triggers a redirect to the canonical sitemap.
A request for this non-existent sitemap:
Redirects to the canonical sitemap:
But that’s probably not a good way to manage a sitemap that doesn’t exist.
The correct response from the server should be to display a 404 Page Not Found error response message, because that is what happened, the page was not found.
The Yoast SEO plugin responds correctly by serving a 404 response code for XML sitemaps that do not exist (except variants numbered zero and 1).
I asked Rank Math about this and they explained that it was not a problem at all.
“This is similar to how WP core handles site search: you will receive an HTTP 200 response for any arbitrary search request.
Unlike some sitemap plugins, Rank Math does not generate physical sitemap files in the server root directory.
Since these non-existent sitemap URLs aren’t present anywhere on the site, Google and other search engines will never crawl them, so this shouldn’t be a problem from an SEO perspective.
Rank Math Duplicate Sitemap Bug
Interestingly, Rank Math, like a few other SEO plugins, has a duplicate sitemap bug.
When it comes to optimizing a website for search engines, the goal is to be as perfect as possible. Anything that makes a website less than perfect can be considered a flaw when perfection is the goal.
Less than perfect optimization can lead to unintended consequences.
Yoast is aware of the issue and would be working on a fix. Hopefully the duplicate sitemap issue with Rank Math will also be resolved at some point.
Read Google’s sitemaps web page