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 me.how to make .xml file content-type: application/xml instead of text/html
Try to use a php file. sitemap.php
<?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.
3 Likes
This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.