Why Your Rank Math Sitemap Triggers the Error: “X-Robots-Tag HTTP Header Detected: noindex” — The Complete Google Search Console Fix (2025 Update)
If Google Search Console shows the error “X-Robots-Tag HTTP header detected: noindex,” it often comes from Rank Math’s default sitemap headers and Google’s stricter interpretation introduced in 2024–2025. This guide walks you through the accurate, verified fix using WPCode.

The Google Search Console noindex error has become increasingly common among WordPress users—especially those using Rank Math to generate sitemaps. Since late 2024, Google has begun interpreting sitemap headers more strictly, causing sites to suddenly show warnings such as:
- “X-Robots-Tag HTTP header detected: noindex”
- “Couldn’t fetch”
- “Indexed, but blocked by robots tag”
It may look serious, but the issue usually isn’t that your content is marked noindex. Instead, Google is flagging your sitemap.xml because the file itself contains a noindex header—added automatically by Rank Math.
Fortunately, the fix is clear and reliable.
1. Why Google Search Console Flags the Sitemap as noindex
Rank Math adds the header X-Robots-Tag: noindex to every sitemap file by default. This was never a problem in the past because:
- Google does not index sitemap files
- Google only reads them to discover URLs
However, in late 2024 → 2025, Google’s crawler began interpreting this header more strictly. As a result, many Rank Math users suddenly started seeing errors—often beginning around mid-November.
2. How to Confirm Your Sitemap Has the noindex Header
(1) Check directly in the browser
Open:
https://your-site.com/sitemap_index.xml
Open Developer Tools → Network → Select the sitemap → Headers Look for:
X-Robots-Tag: noindex
If you see it, this is the cause.
(2) Verify using an external tool
Go to: https://httpstatus.io/
Enter your sitemap URL → Check Response Headers
If noindex appears, the issue is confirmed.
3. The Most Reliable Fix (2025): Remove the Header via WPCode
Even Rank Math’s support team now recommends removing the header if Google Search Console flags it.
The easiest and safest method is adding a WPCode snippet.
How to Apply the Fix
Go to WordPress Admin:
WPCode → Code Snippets → Add New
- Title: Remove noindex from Rank Math sitemaps
- Code Type: PHP Snippet
Paste this code:
add_filter( 'rank_math/sitemap/http_headers', function( $headers ) {
if ( isset( $headers['X-Robots-Tag'] ) ) {
unset( $headers['X-Robots-Tag'] );
}
return $headers;
});
- Location: Run Everywhere
- Save → Activate
This removes the noindex header from all sitemap files, including:
- sitemap_index.xml
- post-sitemap.xml
- category-sitemap.xml
4. Important Steps After Applying the Code
1) Clear all caches
- WP Fastest Cache → Delete Cache → All
- Clear other cache plugins if used
2) Regenerate Rank Math’s sitemap cache
Go to: Rank Math → Sitemap Settings
Change:
- Links Per Sitemap → 200 → 199 → Save
- Then 199 → 200 → Save again
This forces a fresh sitemap rebuild.
3) Resubmit the sitemap in Google Search Console
Delete the old entry and re-submit:
https://your-site.com/sitemap_index.xml
Most sites update to “Success” within 10–60 minutes.
5. Additional Checks (Optional but Recommended)
- Site Kit does not affect this issue
- Polylang still uses a single unified sitemap—no conflict expected
- Check your
.htaccessfor manual header rules - Some hosting providers add headers automatically (rare, but possible)
6. Final Thoughts
This issue is not caused by WordPress or Rank Math itself. It’s the result of Google’s changed interpretation of sitemap headers starting in late 2024.
The good news: Removing the header via WPCode resolves the issue instantly, and Google Search Console returns to normal indexing behavior shortly after resubmission.
Keeping an eye on sitemap headers is becoming increasingly important for stable SEO performance.