The popular WordPress SEO plugin Rank Math was found to have a bug that caused it to generate duplicate sitemap files. This strange bug about how sitemaps are generated is similar to the one affecting Yoast, but Rank Math handles it differently.
Sitemap
Sitemaps are an important part of SEO. It tells search engines which pages have been newly added to the site and which pages have been updated.
Sitemaps help search engines prioritize their website crawling by alerting them to new content that needs to be indexed.
Due to the importance of sitemaps to SEO, it is a good practice to generate sitemaps correctly.
Google’s developer page About the sitemap says:
“A sort of Sitemap is a file where you can provide information about pages, videos, and other files on your website and the relationship between them.
Search engines such as 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 those files. For example, when the page was last updated and any alternate language versions of the page. “
Rank Math XML Sitemap Error
Rank Math also generates several XML sitemaps. In fact, it may generate an infinite number of XML sitemaps.
For example, a site with a single sitemap for “posts” would generate the following duplicate sitemap:
/post-sitemap.xml /post-sitemap1.xml
but it doesn’t generate zero-numbered variants, /post-sitemap0.xml
The same goes for duplicate sitemaps generated for pages:
/page-sitemap.xml /page-sitemap1.xml
Again, just like the Posts sitemap, Rank Math does no Generate zero-numbered sitemap variants: /page-sitemap0.xml
Rank Math to generate an unlimited number of sitemaps?
While Rank Math does not generate zero-numbered sitemap variations, Rank Math does generate a seemingly infinite number of numbered XML sitemaps.
Ideally, Rank Math should generate a 404 response code for a nonexistent sitemap.
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 request for a valid webpage) and then generates an empty XML sitemap.
Here are the URLs I tested to see what Rank Math generates:
https://rankmath.com/post-sitemap9.xml
This is what Rank Math shows:
Nonexistent sitemap generated by Rank Math
How many sitemaps will Rank Math generate?
Obviously, Rank Math may generate many URLs, possibly an infinite number of XML sitemap pages.
I was able to generate a blank sitemap using this URL:
https://rankmath.com/post-sitemap9999999999999999999999999999999999999999999.xml
The scary thing about generating the above sitemap is that the server generates a 200 response code.
I verified that Rank Math passed HTTP Status Website.
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 duplicate sitemaps when the number zero is added to the end of the sitemap URL.
However, Rank Math will not create duplicate sitemaps with zero numbers.
When you request a zero-numbered sitemap that doesn’t exist, the request triggers a redirect to the canonical sitemap.
Request for this non-existing sitemap:
/page-sitemap0.xml
Redirect to canonical sitemap:
/page-sitemap.xml
But this is arguably not the right way to deal with a sitemap that doesn’t exist.
The correct server response should be to display 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 way, giving 404 response codes for non-existing XML sitemaps (except zero and 1 numbered variants).
I asked Rank Math and they explained it wasn’t a problem at all.
Rank Math:
“This is similar to how WP core handles on-site search: you’ll get an HTTP 200 response to any search query.
Unlike some sitemap plugins, Rank Math does not generate physical sitemap files in the root directory of the server.
Since these non-existing sitemap URLs don’t exist anywhere on the site, Google and other search engines will never crawl them, so from an SEO perspective, this shouldn’t cause any problems. “
Rank Math Duplicate Sitemap Error
Interestingly, Rank Math, like some other SEO plugins, has a duplicate sitemap bug.
When optimizing a website for search engines, the goal is to be as perfect as possible. When perfection is the goal, anything that makes a site less than perfect can be considered a flaw.
Imperfect optimization can lead to unforeseen consequences.
Yoast is aware of this issue and is said to be working on a fix. It is hoped that the duplicate sitemap issue with Rank Math will also be resolved at some point.
Citation:
Read Google’s page about sitemaps
!function(f,b,e,v,n,t,s) {if(f.fbq)return;n=f.fbq=function(){n.callMethod? n.callMethod.apply(n,arguments):n.queue.push(arguments)}; if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0'; n.queue=[];t=b.createElement(e);t.async=!0; t.src=v;s=b.getElementsByTagName(e)[0]; s.parentNode.insertBefore(t,s)}(window,document,'script', 'https://connect.facebook.net/en_US/fbevents.js');
if( typeof sopp !== "undefined" && sopp === 'yes' ){ fbq('dataProcessingOptions', ['LDU'], 1, 1000); }else{ fbq('dataProcessingOptions', []); }
fbq('init', '1321385257908563');
fbq('track', 'PageView');
fbq('trackSingle', '1321385257908563', 'ViewContent', { content_name: 'rank-math-duplicate-site-map', content_category: 'news seo wp ' });



