3

I've just migrated my website from HTTP to HTTPS. And now my sitemap.xml file is no longer served as XML:

https://www.pretty-story.com/sitemap_index.xml

Any idea what could be the cause? Is there anything special to configure in Apache?

  • I'm not sure why moving to HTTPS would change the Apache configuration. Your sitemap is now served as Content-Type: text/html; charset="UTF-8" which is probably the configured default content type – Stephen Ostermiller May 25 '17 at 12:27
2

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.