You might come across the error ‘Incorrect HTTP header content-type’ while validating your sitemap with external tools, like the one shown below. In this knowledgebase article, we’ll show you how to fix this error.
This error appears when the server expects an XML sitemap during validation. But instead, it has received a response of a different content type, which could be an HTML, 404 error, or perhaps the server itself blocked from accessing the sitemap.
Fix Incorrect HTTP Header Content Type Sitemap Error
To get rid of this error, you can follow the steps we’ve discussed below.
1 Flush Permalinks
To begin with, we would flush the permalinks. To do so, navigate to WordPress Dashboard > Settings > Permalinks. You don’t need to make any changes to the permalinks settings here. Just click the Save Changes button, and your Permalinks will be flushed.
2 Flush Sitemap Settings
Next, we will flush the sitemap settings in Rank Math. To do so, head over to Rank Math > Sitemap Settings inside your WordPress admin area.
Simply change the value in the Links Per Sitemap, say if it is 200, just change it to 201 or anything else. You don’t need to worry, as you can always change this setting as per your preference. If the Links Per Sitemap option is unavailable for you, then make sure you’ve switched to the Advanced Mode in Rank Math.
Then click the Save Changes button at the bottom of the page.
3 Exclude Sitemap from Caching
Although caching is an effective way to speed up the performance of your website, if not configured, you would end up caching your sitemap as well. A sitemap is an index of all the posts, pages, and custom posts present on your website and should stay up to date for search engines to crawl. When sitemaps are cached, it loses its purpose and sometimes may end up with an error as we’re seeing.
While there are various plugins available to cache your website, we have got an extensive tutorial that will help you exclude your sitemap from being cached.
4 Check Restrictions from Web Host
If you’re able to access the sitemap, but any external sitemap validator or search engine crawler is returned with the error, then it is likely, the sitemap access to these crawlers and bots is restricted by a security plugin installed on your website or by your web host.
When the security plugin installed on your website seems to be causing trouble, simply exclude the sitemap from your firewall and then run through the test once again.
In case of security measures from your web hosting, please reach out to your web host for further assistance.
And, that’s it! Once you’ve made the changes, the error should be resolved. You can confirm the same by testing your sitemap with any XML Sitemap validator. If you’re still facing this error or need any help in configuring sitemaps, please feel free to reach our support team directly from here, and we’re always here to help.