IE8 Downloading docx Files As zip On Apache

23rd January 2012

I recently built a Drupal site on an Apache server sertup and everything seemed fine until someone running IE8 tried to download a .docx file. For some reason IE8 insisted that this file was a .zip file and would open it as such, causing a bit of confusion as to what the problem was. I assumed that this was due to the mime type of the file not being set properly, but I decided to do a quick search to see if I could find anything to corroborate this. I thought it might be something odd that IE8 was doing as everything else was downloading the file perfectly.

After wading through multiple support forums and finding very little of any help I eventually gave up and went with my first hunch and set the mime type for the .docx file extension in the sites .htaccess file. Here is the rule I used:

  1. AddType application/vnd.openxmlformats-officedocument.wordprocessingml.document docx

This solved the problem right away. To cover my bases for any future idiocy from IE8 I thought it might be good to set up some other mime types for Microsoft Office files. Here is the final list:

  1. AddType application/vnd.ms-word.document.macroEnabled.12 .docm
  2. AddType application/vnd.openxmlformats-officedocument.wordprocessingml.document docx
  3. AddType application/vnd.openxmlformats-officedocument.wordprocessingml.template dotx
  4. AddType application/vnd.ms-powerpoint.template.macroEnabled.12 potm
  5. AddType application/vnd.openxmlformats-officedocument.presentationml.template potx
  6. AddType application/vnd.ms-powerpoint.addin.macroEnabled.12 ppam
  7. AddType application/vnd.ms-powerpoint.slideshow.macroEnabled.12 ppsm
  8. AddType application/vnd.openxmlformats-officedocument.presentationml.slideshow ppsx
  9. AddType application/vnd.ms-powerpoint.presentation.macroEnabled.12 pptm
  10. AddType application/vnd.openxmlformats-officedocument.presentationml.presentation pptx
  11. AddType application/vnd.ms-excel.addin.macroEnabled.12 xlam
  12. AddType application/vnd.ms-excel.sheet.binary.macroEnabled.12 xlsb
  13. AddType application/vnd.ms-excel.sheet.macroEnabled.12 xlsm
  14. AddType application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx
  15. AddType application/vnd.ms-excel.template.macroEnabled.12 xltm
  16. AddType application/vnd.openxmlformats-officedocument.spreadsheetml.template xltx

Just drop this into your .htaccess file or your mime.types file to get IE8 to correctly download the files.

Comments

Permalink
Thank you, thank you, thank you! I was going through the same situation with all the other websites proving no help to sort the issue, they just wanted you to update browsers - which doesn't help web developers at all.

Gstar (Thu, 08/02/2012 - 04:30)

Permalink
As you may already know, putting a list of all MS Office types is a bear. Thanks for doing all the heavy lifting.

Claude (Tue, 12/18/2012 - 16:22)

Permalink
Thank you :-) Worked like a charm!

Marie (Fri, 05/24/2013 - 07:32)

Add new comment

The content of this field is kept private and will not be shown publicly.