I've just migrated my website from HTTP to HTTPS. And now my sitemap.xml file is no longer served as XML:
Any idea what could be the cause? Is there anything special to configure in Apache?
Webmasters Stack Exchange is a question and answer site for pro webmasters. It only takes a minute to sign up.Sign up to join this community
The MIME-type is not set for the .xml file extension in your Apache configuration, it's coming through as
document instead of
application/xml. Perhaps you had a suitable configuration for this before but in a section of your Apache configuration that only applies to HTTP and not HTTPS, or did your website actually change server software environment or switch hosting company etc in the process in which case the Apache configuration may simply be different. Either way, to solve this you will need to:
(a) Insert the following lines into your \etc\httpd\conf\httpd.conf file:
<IfModule mime_module> AddType application/xml .xml </IfModule>
(b) OR the following line into a .htaccess file in your website folder:
AddType application/xml .xml
You may need to edit existing sections and just add the lines necessary to prevent there being duplicate sections/entries. If the server is managed by another company and you do not control the Apache configuration you will need to follow option (b), though this is the simplest/safest solution anyway, it just means it will only benefit this website and not others on the server.