Sitemap How to make content-type be Application/xml not a text/html

I been creating a sitemap but Google need application/xml but the file generated is always detected as html . Is there someone who can explain to to make .xml file content-type: application/xml instead of text/html

Try to use a php file. sitemap.php

header("Content-type: application/xml");
echo "<?xml version=\"1.0\" ?>";
// and output any xml through the php echo statement

I’m using the code above

And create output like this…
I also configure hcdocs/.htaccess Rewrite rule to pass sitemap.xml to sitemap.php

But a validator and Google search console detect it as text/html

Did you check through an XML validator? Google thinks your file is written in HTML, so check it.

1 Like

Note that our browser validation system may also prevent sitemap validators from working correctly:

The security challenge is also presented as HTML content, which may explain the content type.


This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.