Apache MIME type configuration to open .docx .pptx .xlsx MS Office files
Anthony Gee | Feb 24, 2010 | Comments 7
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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
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 |
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:
1 |
AddType application/vnd.openxmlformats .docx .pptx .xlsx |
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:
1 |
AddType application/vnd.openxmlformats .docx .pptx .xlsx .xltx . xltm .dotx .potx .ppsx |
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
- xlsx mime type (458)
- mime type xlsx (313)
- mime type docx (211)
- docx mime type (162)
- mimetype xlsx (119)
- mime type for xlsx (118)
- mime xlsx (99)
- xlsx mime (83)
- mimetype docx (76)
- MIME docx (76)
- XLSX mimetype (71)
- Mime Types XLSx (69)
- apache mime types docx (53)
- pptx mime type (47)
- mime type pptx (39)
- docx mimetype (38)
- mime types docx (36)
- type mime xlsx (32)
- apache mime type docx (31)
- mime type for docx (30)
Filed Under: Apache
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.
You save my day man!
Hi Benny Boonen,
Your .htaccess file have to be placed in document-root folder for the current web project.
Thank you it works now.
Hi,
If I’m doing these changes on app server, does the server need MS Office installed on it for this to work?
Not really, for sure. It is related to the MIME types of the Web server installed.
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.
Jason,
Thanks for the info. But, I tried your statement in the .htaccess file and still i get the popup message from IE that wants me to download the file instead of just launching the .ppsx file in player mode. Any other ideas?
Steve