-
Help my sitemap is showing Incorrect http header content-type: “” (expected: “application/xml”)
Sitemap content is empty
-
Hello,
I apologize for the issue you are facing with your sitemap showing the "Incorrect HTTP header content-type" error and being empty. This error typically occurs when the server expects an XML sitemap but receives a different content type instead. Here are some steps you can take to resolve this issue:
1. Flush Permalinks
- Go to WordPress Dashboard → Settings → Permalinks.
- Click the Save Changes button without making any changes. This will flush your permalinks.
2. Flush Sitemap Settings
- Navigate to Rank Math SEO → Sitemap Settings.
- Change the value in the Links Per Sitemap (e.g., if it is 200, change it to 201) and click Save Changes.
3. Exclude Sitemap from Caching
- Ensure that your sitemap is not being cached by any caching plugins. You can follow this tutorial to exclude your sitemap from caching.
4. Check Restrictions from Web Host
- If you can access the sitemap but external validators return an error, check if your web host or a security plugin is blocking access to the sitemap. You may need to exclude the sitemap from any firewall settings or contact your web host for assistance.
5. Add Filter to Theme’s
rank-math.php
File- If the above solutions do not work, you can add a filter to your theme’s
rank-math.php
file:add_filter( 'rank_math/sitemap/enable_caching', '__return_false' );
- Make sure to do this in a child theme to avoid losing changes during updates.
After making these changes, clear your website cache and check your sitemap again. If you continue to experience issues, please reply to this ticket with your site URL, and a human agent from our support team will assist you further.
Sources:
How to Fix "Incorrect HTTP Header Content-Type" Error in Sitemaps » Rank MathI need a better and urgent fix because my post are not indexed by google and it’s been days now
Hello,
Thanks for contacting Rank Math support. We apologise for any inconvenience this might have caused you.
Please follow the steps below to see if that works for you.
#1. Flush the Sitemap cache by following this video screencast:
https://i.rankmath.com/pipRDp#2. Exclude the Sitemap files of the Rank Math plugin from caching. The cache could be via a plugin or from the server. For plugins or Cloudflare, please follow this article:
https://rankmath.com/kb/exclude-sitemaps-from-caching/#3. If the above steps doesn’t seem to work, kindly apply the following filter code to your site.
add_filter( 'rank_math/sitemap/enable_caching', '__return_false');
Here’s how you can add filter/hook to your WordPress site:
https://rankmath.com/kb/wordpress-hooks-actions-filters/Once done, please clear your website cache including server-side cache, and check the sitemap again.
Let us know how it goes. We look forward to hearing from you.
Thank 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.
The ticket ‘Sitemap Validation issues’ is closed to new replies.