XML Sitemap /sitemap_index.xml Returns X-Robots-Tag: noindex in HTTP Headers

#1080059
  • Resolved Juxhin Bregu
    Rank Math free

    Hi Rank Math Team,

    I need help with an issue affecting my site’s XML sitemap. My primary sitemap, generated by Rank Math (/sitemap_index.xml), is returning the following HTTP header:

    makefile
    Copy
    Edit
    X-Robots-Tag: noindex
    I confirmed this using Chrome DevTools (see attached screenshot). This is causing concerns with Google Search Console and may be limiting the number of URLs Google discovers or indexes. For reference, Bing Webmaster Tools is reading the sitemap with no issue, but Google is more sensitive about sitemap headers and best practices.

    Here’s what I’ve already done to troubleshoot:

    Checked Rank Math settings:
    I don’t see any “noindex” option for XML sitemaps and haven’t enabled anything related to this in the plugin.

    Checked .htaccess and server config:
    There are no rules in my .htaccess or server configuration that add or modify X-Robots-Tag for XML files.

    Checked security and cache plugins:
    I use Wordfence and Litespeed Cache, but I’ve tried allowlisting /sitemap_index.xml and disabling plugins with no change. The noindex header persists even with the firewall in learning mode or temporarily disabled.

    Contacted my hosting provider (Hostinger):
    Hostinger support says their server does not set this header and that my account has no forced HTTP header rules.

    Verified the issue is specific to Rank Math’s sitemap:
    Other static XML files do not return the X-Robots-Tag: noindex header—only the dynamic sitemap generated by Rank Math.

    Questions:

    Is there a hidden setting, filter, or function in Rank Math that could be adding this header?

    Are there known compatibility issues with security or caching plugins that might trigger this behavior?

    How can I force Rank Math’s sitemap output to avoid sending any X-Robots-Tag header at all (which is Google’s best practice for sitemaps)?

    Can you provide a snippet or guidance for removing this header, if it’s being set by Rank Math or a conflict?

    I’ve attached a screenshot from Chrome DevTools showing the network request and headers for /sitemap_index.xml for your reference.
    X-Robots noindex tag
    Site: thejustifiable.com
    WP Environment: Shared hosting (Hostinger), PHP 8.2.27
    Plugins: Rank Math SEO, Wordfence, Litespeed Cache
    Thanks in advance for your help!
    I’m happy to run any diagnostics or provide admin access if needed.

    Juxhin Bregu

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

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

    To address your questions:

    1. Hidden Settings or Filters in Rank Math: There isn’t a specific setting in Rank Math that would add a noindex header to the sitemap by default. However, it’s possible that a filter or custom code in your theme or a plugin could be affecting this. You might want to check your theme’s functions.php file or any custom plugins for any code that might be adding this header.

    2. Compatibility Issues with Security or Caching Plugins: While Rank Math is designed to work well with most caching and security plugins, conflicts can sometimes arise. Since you’ve already tried allowlisting the sitemap and disabling plugins without success, it seems less likely that these plugins are the cause. However, you might want to check if there are any specific settings in Wordfence or Litespeed Cache that could be affecting dynamic content.

    3. Forcing Rank Math’s Sitemap to Avoid Sending X-Robots-Tag: You can try adding the following snippet to your theme’s functions.php file to disable caching for the sitemap, which may help resolve the issue:

      add_filter( 'rank_math/sitemap/enable_caching', '__return_false' );

      This will ensure that the sitemap is always generated fresh and may help eliminate any unwanted headers.

    If these steps do not resolve the issue, 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 more tailored assistance.

    Thank you for raising this concern, and we hope to help you resolve it soon!

    Sources:
    Rank Math Sitemap Issues and Their Fixes » Rank Math
    How to Fix Submitted URL Marked ‘NoIndex’ Error » Rank Math

    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,

    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 2 replies - 1 through 2 (of 2 total)

The ticket ‘XML Sitemap /sitemap_index.xml Returns X-Robots-Tag: noindex in HTTP Headers’ is closed to new replies.