On my Apache server I have stored several docx, xlsx pptx files.
Some client browsers think that theses are regular zip files and change the file extension when downloading. How do I make it not do that anymore.
(Using Ubuntu server)
The files are actually ZIPs of XML documents. Add this to your .htaccess in Apache
The server doesn't have proper mime types set up for the new ms file types
add the following to the /etc/mime.types file and restart apache and the problem should be fixed.
http://www.webdeveloper.com/forum/showthread.php?t=162526 has information about this problem
Sounds like your web server is looking at the magic numbers inside these files and seeing that they ARE zip files.
Have a look at: http://www.webdeveloper.com/forum/showthread.php?t=162526
I have total administrative control of both the server and the client machine involved with this problem and NONE of these proposed solutions worked for correcting this problem.
In the end, the only thing that FIXED this issue for me was to....
1) uninstall 7-Zip (so the browser has nothing to associate with the zip file)
2) (Not sure if this step is required, but) I then downloaded the DOCX again, (where, coincidentaly, it's still being presented as a ZIP file), however, this time I am prompted for what application to open it with and I choose MSWORD. I don't choose "Always open with MSWORD", because I don't want MSWORD always opening ZIP files.
3) Re-install 7-Zip.
After this, all subsequent attempts to download the DOCX, actually resulted in a DOCX file being download and opened with the appropriate MSWORD application.
NOTE: Before you jump to the conclusion that I simply had a broken file association, let me confirm, that when this problem was occurring, I could double-click on any DOCX in explorer and MSWORD would always open it. This problem was always and only occurring when trying to download/open a DOCX with IE8. FF4 and Chrome both worked flawlessly. I tried adding the proper MIME types to /etc/mime-types and to .htaccess on the server side. I also tried Disabling "Open files based on content, not file extension" (but this only resulted in the browser open the DOCX as unreadable ASCII text), setting the FEATURE_MIME_* registry keys to "0", and adding the server URL to the "Trusted Sites" list. Again, NONE OF THESE SEEMINGLY LOGICAL SOLUTIONS WORKED FOR ME.
I hope this is helpful to someone. Cheers!
Download http://packages.ubuntu.com/oneiric/mime-support, and install it with dpkg -i. Worked great!
PS: Apache on Ubuntu and Debian reads from /etc/mime.types