Apache MIME type configuration to open .docx .pptx .xlsx MS Office files

I had some issues recently with the new MS Office files like: .docx .pptx .xlsx – opening up from Internet Explorer as ZIP or other type files.

It really depends on the Apache MIME type configuration for the .docx, .pptx, .xlsx, etc files.

The official MIME type configuration for MS Office 2007,2008 files is this one:

MIME is extensible. Its definition includes a method to register new content types and other MIME attribute values, but the only apache MIME type configuration for .docx .pptx .xlsx that works for me was the fallowing:

The reason why is that probably lays in the core of what is MIME.
MIME (Multipurpose Internet Mail Extensions) is an Internet standard for describes message content types.MIME messages can contain text, images, audio, video, and other application-specific data.

Official MIME info is provided by the following documents:
RFC-822 Standard for ARPA Internet text messages
RFC-2045 MIME Part 1: Format of Internet Message Bodies
RFC-2046 MIME Part 2: Media Types
RFC-2047 MIME Part 3: Header Extensions for Non-ASCII Text
RFC-2048 MIME Part 4: Registration Procedures
RFC-2049 MIME Part 5: Conformance Criteria and Examples
Different applications support different MIME types and if you can find better resolution of this issue with Internet Explorer I will be glad to see it in the comments section.
Certainly you can add all MS Office 2007 / 2008 MIME types, like this:

Just create one .htaccess file (or edit if there is an existing one) and add the above line. Hope that will work for you guys.

And one last thing which is important! If you edit the ‘/etc/mime.types’ file do not forget to restart the Apache server. Otherwise the changes will not take effect.

Tags

Filed Under: Apache

Anthony Gee About the Author: Anthony G. is an IT specialist with more than 9 years of solid working experience in the Web Hosting industry. Currently works as server support administrator, involved in consultative discussions about Web Hosting and server administration. One of the first writers in the Onlinehowto.net website, now writing for Free Tutorials community - he is publishing tutorials and articles for the wide public, as well as specific technical solutions.

Comments (6)

  1. Tom Herbert says:

    You save my day man!

  2. Hi Benny Boonen,

    Your .htaccess file have to be placed in document-root folder for the current web project.

  3. Benny Boonen says:

    Thank you it works now.

  4. Kristijonas says:

    Hi,
    If I’m doing these changes on app server, does the server need MS Office installed on it for this to work?

  5. Jason says:

    If you are having problems with ppsx files opening in edit mode instead of the player with IE browsers then try adding the following code lines to your .htaccess file:

    FilesMatch “\.(?i:ppsx)$”
    ForceType application/octet-stream
    Header set Content-Disposition attachment
    /FilesMatch

    you will need to wrap the FilesMatch lines in Greater than and less than HTML tags

    this code forces the file type as octet-stream and forces the header content-dispostion type as attachment. this tells the browser to download the file first then open it.

Leave a Reply