Popular WordPress SEO plugin, Rank Math, has been found to have a bug that causes it to generate duplicate sitemap files. This strange bug in how sitemaps are generated is similar to one that affects Yoast, but the way Rank Math handles it is different.
Website Sitemap
A sitemap is an important part of search engine optimization. It tells search engines which pages have been newly added to a site and which pages have been updated.
The sitemap helps a search engine prioritize their website crawling by alerting it to new content that needs to be indexed.
Because of the importance of a sitemap for SEO, it is a good practice that sitemaps are generated correctly.
Google’s developer page about sitemaps says:
“A sitemap is a file where you provide information about the pages, videos, and other files on your site, 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 you think are important in your site, and also provides valuable information about these files. For example, when the page was last updated and any alternate language versions of the page.”
Rank Math XML Sitemap Bug
Rank Math also generates multiple XML sitemaps. In fact, it generates possibly an infinite number of XML sitemaps.
For example, a site with a single sitemap for “posts” will generate the following duplicate sitemaps:
/post-sitemap.xml /post-sitemap1.xml
But it won’t generate the zero numbered variant, /post-sitemap0.xml
The same is true for duplicate sitemaps generated for pages:
/page-sitemap.xml /page-sitemap1.xml
And again, just like for the “posts” sitemaps, Rank Math does not generate the zero-numbered sitemap variant: /page-sitemap0.xml
Rank Math Generates Infinite Number of Sitemaps?
While Rank Math doesn’t generate the zero-numbered sitemap variant, Rank Math does generate what appears to be a near infinite amount of numbered XML sitemaps.
Ideally, Rank Math should generate a 404 response code for sitemaps that don’t exist.
But what appears to be happening is that instead of generating a 404 response message Rank Math is generating a 200 response code (meaning it’s a request for a valid web page) and then generating an empty XML sitemap.
The following is a URL that I tested to see what Rank Math generated:
https://rankmath.com/post-sitemap9.xml
This is what Rank Math shows:
Non-existent Site Map Generated by Rank Math
How many sitemaps will Rank Math generate?
Apparently, Rank Math may generate a lot of URLs, possibly an infinite amount of XML sitemap pages.
I was able to generate a blank sitemap with this URL:
https://rankmath.com/post-sitemap9999999999999999999999999999999999999999999.xml
What’s of interest about the above sitemap is that the server generates a 200 header response code to a browser when serving that XML site map.
The 200 response code means that there is no error.
I verified whether Rank Math generated a 200 response code via the HTTPStatus website.
This shows that Rank Math generates a 200 response code for pages that do not 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 however does not create a duplicate sitemap with the number zero.
When you make a request for the non-existent zero-numbered sitemap, the request triggers a redirect to the canonical sitemap.
A request for this non-existent sitemap:
/page-sitemap0.xml
Redirects to the canonical sitemap:
/page-sitemap.xml
But that is arguably not a correct way to handle a sitemap that does not exist.
The correct server response should be to show a 404 Page Not Found Error Response message, because that’s what happened, the page was not found.
The Yoast SEO plugin responds in the correct manner by serving a 404 response code for XML sitemaps that don’t exist (except for the zero and 1-numbered variants).
I asked Rank Math about it and they explained that it’s not an issue at all.
Rank Math:
“This is similar to how WP core handles on-site search: you will receive HTTP 200 response for any arbitrary search query.
Unlike some sitemap plugins, Rank Math does not generate physical sitemap files in the server’s root directory.
Since these non-existent sitemap URLs are not present anywhere on the site, Google and other search engines will never crawl them, so this shouldn’t cause any issue from an SEO point of view.”
Rank Math Duplicate Site Map Bug
It’s interesting that Rank Math, like a few other SEO Plugins, has a duplicate site map 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 unforeseen consequences.
Yoast is aware of the problem and is said to be working on a fix. One would hope that the duplicate site map issue with Rank Math will also be fixed at some point.
Citation:
Read Google’s Web Page About Sitemaps