Office 2007 MIME types for Apache

Linux, Microsoft, System Admin

An interesting bug came up in the OWN Forums over the weekend, when downloading Office 2007 Word (docx) document from an Apache hosted site, the file either comes up garbled (application/octet-stream) or opens up a zip folder. This is usually the case when you have a mime-type and content-type mismatch and can get even uglier.. so what’s the solution? You have to define new Office 2007 mime types in your web server (or more precisely, server-side mime type database) so it knows how to communicate the content properly to the web browser. Office 2007 uses the new zipped XML OpenDocument format. After Googling for a few minutes and not finding the solution on the first four pages of searches I came to my buddy David Overton’s page – Now I remember where I read about the new Office 2007 mime types! I’m sure David will be extatic to know his hard work (which applies to IIS6 by the way) is now going to help Apache users everywhere get Office 2007 documents easilly. Joke aside, truth is Apache is the dominant web server and there is at least 70% chance you’re browsing an Apache site (you are right now, it’s what powers Vladville!) or about 98% chance if you’re not in a corporate environment.

Office 2007 mime types from David Overton.

First you’ll notice that there are many different mime types associated with Office 2007 OpenDocument format for just Word documents and templates: .docx, docm, dotm, dotx:

.docm = application/

.docx = application/vnd.openxmlformats-
.dotm = application/
.dotx = application/vnd.openxmlformats-officedocument.


You can hardcode in one of these at a time, however, there is a shortcut. Just open your /etc/mime.types and add this to the last line:

application/vnd.openxmlformats       docx pptx xlsx

Restart the Apache service and you’re set. This takes care of the top three popular Office 2007 formats. If you don’t have access to the system mime type configuration (you likely don’t) you can always override the settings using your .htaccess file. Enjoy and thank David! Here is the end result:


Extra note: Above applies to Apache servers hosted on Linux, however, if you host your Apache server on Windows the server distribution is likely shipping a mime configuration database in a specific path, one that you may or may not be able to find easilly. No worries, you can always add the content types directly to the httpd.conf file which is very easy to locate in most popular Windows Apache distributions such as Vertrigo. To add the new mime type directly in Apache httpd.conf (for Linux fans, /etc/httpd/conf/httpd.conf):

AddType  application/vnd.openxmlformats  .docx .pptx .xlsx

Please note that httpd.conf definitions override the /etc/mime.types definitions and dependant on the directory configuration, htaccess can (and usually does) override both.

7 Responses to Office 2007 MIME types for Apache

  1. Pingback: the foremind » Blog Archive » Office 2007 document types and webservers

  2. Pingback: Big IDEA » Blog Archive » Do your .docx (Word 2007) files get renamed to .zip?

  3. Abdel says:

    i added the same in my Apache server. Things work fine for docx and xlsx. But the pptx is still downloaded as ZIP file. Any clue? Am I missing anything??? 🙁

  4. Will says:

    my application recognizes and opens 2007 documents when i click to view them from my app because i set my Jaguar server to recognize the new 2007 mime types.

    However, on a computer that has windows 2000 with the office 2007 compatibility pack installed, it does not open word 2000 when i click on the file to view while in my app. I have to save the file to the server and then open it with Word 2000. Is there a way to keep from having to do this?

  5. Pingback: Office 2007 MIME types and apache | todd's thoughts

  6. kimberly says:

    Has anyone had any issues with Apache DiskFileUpload not recording the correct mime type for docx files when the document is attached when it is open. I found that the correct mime type is recorded when the document is closed then attached. Is this a limitation of the apache?

  7. Pingback: Register Office 2007 file format MIME types on servers - Office Resource Kit Blog - Site Home - TechNet Blogs

Comments are closed.