Microsoft Office 2007 MIME Types with Apache and IIS

Apache , IIS , Misc , MS Office , Server and Hosting Add comments

I was working with a 3rd Party file service \ handling provider and came across an issue whereby when I uploaded a Microsoft Office 2007+ document the "detected MIME type" was being returned as "application/zip".

Turns out there's an easy enough fix for this for their servers.  Simply update the web server to include the new \ incorrect MIME types.  

APACHE

There are two methods you can use to manage this with Apache, mime.types file or in the httpd.conf file.

conf\mime.types

In the file "C:\Program Files\Apache Software Foundation\Apache2.2\conf\mime.types" you can declare your MIME types by simply following the same convention as used in the existing file.

If the file doesn't exist here, look for the section named <IfModule mime_module> in your httpd.conf file which includes the key value pair setting "TypesConfig conf/mime.types".  This is the path to your mime.types file.

httpd.conf - AddType

The AddType directive allows you to add to or override the MIME configuration file types specified in TypesConfig module.

Simply copy the AddType commands below into the <IfModule mime_module> section of the httpd.conf file.

There should already be some examples of this commented out using the '#' symbol at the start of the string.



AddType application/vnd.ms-word.document.macroEnabled.12 .docm
AddType application/vnd.openxmlformats-officedocument.wordprocessingml.document docx
AddType application/vnd.openxmlformats-officedocument.wordprocessingml.template dotx
AddType application/vnd.ms-powerpoint.template.macroEnabled.12 potm
AddType application/vnd.openxmlformats-officedocument.presentationml.template potx
AddType application/vnd.ms-powerpoint.addin.macroEnabled.12 ppam
AddType application/vnd.ms-powerpoint.slideshow.macroEnabled.12 ppsm
AddType application/vnd.openxmlformats-officedocument.presentationml.slideshow ppsx
AddType application/vnd.ms-powerpoint.presentation.macroEnabled.12 pptm
AddType application/vnd.openxmlformats-officedocument.presentationml.presentation pptx
AddType application/vnd.ms-excel.addin.macroEnabled.12 xlam
AddType application/vnd.ms-excel.sheet.binary.macroEnabled.12 xlsb
AddType application/vnd.ms-excel.sheet.macroEnabled.12 xlsm
AddType application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx
AddType application/vnd.ms-excel.template.macroEnabled.12 xltm
AddType application/vnd.openxmlformats-officedocument.spreadsheetml.template xltx


 

IIS

Not to be discriminatory but for anyone using IIS please see the following posts for details on how to manage this:

http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/cd72c0dc-c5b8-42e4-96c2-b3c656f99ead.mspx?mfr=true

and 

http://technet.microsoft.com/en-us/library/ee309278%28office.12%29.aspx

Bookmark and Share

5 responses to “Microsoft Office 2007 MIME Types with Apache and IIS”

  1. Simon Whatley Says:
    You could also be website-specific and include the mime-type declarations in your .htaccess file.

    I suppose you could then lock-down each application by defaulting Apache to not accepting any mime-type, except those declared in .htaccess.
  2. Niall O'Doherty Says:
    Great tip Simon.

    Never really thought about locking down the MIME types on a per-application basis!!
    I like the idea of that though.
  3. Convert Word Document To PDF Says:
    Good posting, I've just stumbled up on this website researching Google for Microsoft office help. I wonder if anyone may help me with a little problem? I'm trying to figure away how to display a current word count yet it is not showing up, I am using 2007.
  4. Niall O'Doherty Says:
    Hi,
    If I understand your questions correctly, you're using Office 2007 and want to get the word count of a document?

    If so the link below should help:
    http://office.microsoft.com/en-us/word-help/count-the-number-of-words-in-a-document-HA001230358.aspx

    Niall.
  5. Vipin Kohli Says:
    many many thanks.. you solved my problem.. thank you very much....

Leave a Reply

Leave this field empty:

Powered by Mango Blog. Design and Icons by N.Design Studio