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/vnd.ms-word.document
.docx = application/vnd.openxmlformats- officedocument.wordprocessingml.document .dotm = application/vnd.ms-word.template .dotx = application/vnd.openxmlformats-officedocument.
wordprocessingml.template
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.
Both comments and pings are currently closed.
|
|
|
Whats on Vlad's Mind?
|
For the less coherent, more grammatically correct realtime insight, follow me on Twitter at
@vladmazek or on Facebook.
|
|
|
|
Sponsors: This blog is made possible by
Own Web Now Corp and ExchangeDefender.
If you like this blog and are in the need of products we offer I hope you give us some
consideration.
|
|
|
|
|
|
Get The Newsletter
|
Looking for a more focused, exclusive insight into the world of SMB tech & business? Sign up for my newsletter:
Click here to sign up
|
|
|
|
|
Vladfire Vlog
|
Vladfire is my video blog showcasing successful people and technology in small to medium business.
Below are a few recent episodes, check out the archive for all other films.
|

See more episodes...
|
|
|
SBS Show Podcast
|
SBS Show is a free weekly podcast (Internet for recorded radio show) focusing on small business and technology. More at sbsshow.com but check out our latest episode:
SBS Show #26
Erick Simpson
Managed Services Part 2

Listen to older shows..
|
|
|
|
| |
|
|
Categories
|
|
Archives
|
|
About
|
| Apple, Awesome, Beta, Blogroll, Boss, Cloud, Deals, E12, Events, Exchange, ExchangeDefender, Friends, Gadgets, Gators, Gaypile, Google, GTD, Humor, iPhone, IT Business, IT Culture, Legal, Linux, Microsoft, Misc, Mobility, Open Source, OS, OwnWebNow, Pimpin, Podcast, Programming, Rant, SBS Show, Security, Shockey Monkey, SMB, System Admin, Thieving Weasel, Uncategorized, Vista, Vladcast, Vladfire, Vladville, Web 2.0, Windows Home Server, WordPress, Work Ethic, Wrong |
 |
May 2013,
April 2013,
March 2013,
February 2013,
January 2013,
December 2012,
November 2012,
October 2012,
September 2012,
August 2012,
July 2012,
June 2012,
May 2012,
April 2012,
March 2012,
February 2012,
January 2012,
December 2011,
November 2011,
October 2011,
September 2011,
August 2011,
July 2011,
June 2011,
May 2011,
April 2011,
March 2011,
February 2011,
January 2011,
December 2010,
November 2010,
October 2010,
September 2010,
August 2010,
July 2010,
June 2010,
May 2010,
April 2010,
March 2010,
February 2010,
January 2010,
December 2009,
November 2009,
October 2009,
September 2009,
August 2009,
July 2009,
June 2009,
May 2009,
April 2009,
March 2009,
February 2009,
January 2009,
December 2008,
November 2008,
October 2008,
September 2008,
August 2008,
July 2008,
June 2008,
May 2008,
April 2008,
March 2008,
February 2008,
January 2008,
December 2007,
November 2007,
October 2007,
September 2007,
August 2007,
July 2007,
June 2007,
May 2007,
April 2007,
March 2007,
February 2007,
January 2007,
December 2006,
November 2006,
October 2006,
September 2006,
August 2006,
July 2006,
June 2006,
May 2006,
April 2006,
March 2006,
February 2006,
January 2006,
December 2005,
November 2005,
October 2005,
September 2005,
August 2005,
July 2005,
|
 |
Vlad says:
Thanks for checking out my blog. You've officially reached the end of the Internet so take in what you've read and don't look at it as gospel but an invitation to start thinking for yourself.
|
|
|
|
| |
Copyright © 2005-2012 Vlad Media, Inc. All Rights Reserved.
Content is provided AS-IS without warranty of any kind.
Syndicate this blog: 
|
|