Critical Bug – Sitemap has X-Robots-Tag: noindex Header

#1066422
  • Resolved Junaid Group
    Rank Math free

    Hello Rank Math Team,
    I have a critical issue where Rank Math is adding an X-Robots-Tag: noindex header to my sitemap (sitemap_index.xml), making it un-indexable. My product pages themselves are indexable, so the issue is isolated to the sitemap file.
    I have performed extensive troubleshooting:
    Checked WordPress “Discourage search engines” setting (it’s off).
    Confirmed my .htaccess and robots.txt files are correct.
    Used Troubleshooting Mode to rule out theme and plugin conflicts.
    The issue persists even with only Rank Math, Elementor, and WooCommerce active.
    Definitive Proof: When I deactivate both Rank Math plugins and install the standard “XML Sitemaps” plugin, it generates a perfectly indexable sitemap at sitemap.xml that passes Google’s Live Test.
    This confirms the bug is internal to the Rank Math plugin. Please advise on a solution.

    Thank you.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hello,

    We apologize for the issue you are facing with the X-Robots-Tag: noindex header being added to your sitemap. Thank you for providing detailed information about your troubleshooting steps; it helps us understand the situation better.

    To resolve this issue, please check the following:

    1. Custom Code: Ensure that there is no custom code in your theme’s rank-math.php file that might be adding the noindex tag. You can refer to our guide on how to add a filter/hook to your site for more information.

    2. Caching: If you are using any caching plugins, ensure that your sitemap is excluded from caching. You can find guidance on how to exclude sitemaps from caching in our tutorial here.

    3. Server Configuration: Sometimes, server-level configurations can inadvertently add headers. Check with your hosting provider to ensure there are no server-level rules affecting the sitemap.

    4. Sitemap Settings: Go to Rank Math SEO → Sitemap Settings and ensure that everything is configured correctly.

    If none of these solutions work, we recommend replying to this ticket with your site URL so that a human agent from our support team can take a closer look at your specific setup and provide further assistance.

    Thank you for your patience, and we look forward to resolving this issue for you!

    Sources:
    How to Fix "Incorrect HTTP Header Content-Type" Error in Sitemaps » Rank Math

    Hello,
    Thank you for the checklist. I have already performed all of these steps and more, and the issue persists. This appears to be a bug within the Rank Math plugin itself.
    Here is a summary of my extensive troubleshooting:
    Rank Math Settings: We have checked every possible setting in Titles & Meta, General Settings, and Sitemap Settings. None of them are causing the issue.
    Troubleshooting Mode: The noindex header on the sitemap persists even in Troubleshooting Mode with only Rank Math, Elementor, and WooCommerce active. This proves it is not a theme or plugin conflict.
    The Definitive Proof: I deactivated both Rank Math plugins and installed a different plugin (“XML Sitemaps” by Auctollo). It generated a sitemap at /sitemap.xml that passed Google’s Live Test perfectly (200 OK, indexable). This proves my server configuration, .htaccess, and robots.txt are all correct. The problem is isolated entirely to Rank Math’s sitemap generation.
    The issue is not caching; the issue is that Rank Math is actively generating an X-Robots-Tag: noindex header on the sitemap file.
    Could you please escalate this ticket to a senior developer to investigate this bug? My site is ready for you to inspect, and the problem is currently active.
    Thank you for your help.

    Hello,

    Please note that RankMath sets the “noindex” tag on your sitemaps by default. It’s done this way because a sitemap is only meant to guide search engines through your site, not to rank in search results.

    The reason you’re seeing it set to “noindex” is to prevent it from appearing in search results, which is the desired behavior.

    You should follow this guide to properly submit your sitemap:
    https://rankmath.com/kb/submit-sitemap-to-google/

    However, if you still wish to remove the noindex tag from your sitemap, you can use the filter on your site:

    add_filter( 'rank_math/sitemap/http_headers', function( $headers ) {
    	if ( '/sitemap_index.xml' !== $_SERVER['REQUEST_URI'] ) {
    		return $headers;
    	}
    	unset( $headers['X-Robots-Tag'] );
    	return $headers;
    } );

    Here’s how you can add a filter/hook to your WordPress site:
    https://rankmath.com/kb/wordpress-hooks-actions-filters/

    Looking forward to helping you.

    Hello,

    Thank you for the response Reinelle, If that is the case why I not able to subit the sitemap to google search console, in the status section it showing the message “Unable to Fetch”. Please help me resolve this issue in the ealiest.

    Thank you.

    Hello,

    In this case, you can follow this guide to fix that issue on your sitemap:
    https://rankmath.com/kb/couldnt-fetch-error-google-search-console/

    Looking forward to helping you.

    I have this same exact problem, please let me know how to rectify.

    Hello,


    @M
    . Rezza Adinata Hutagalung Please refer to our reply above to fix this issue.

    Looking forward to helping you.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 7 replies - 1 through 7 (of 7 total)

The ticket ‘Critical Bug – Sitemap has X-Robots-Tag: noindex Header’ is closed to new replies.