如何使Apache使用正确的Content-Type提供Office 2007文件?

我使用的是SVN Server 1.8和Apache2.2。 当我将Exel 2007文件添加到存储库时,SVN自动将svn:mime-type属性添加到文件的“application / octet-stream”中。 当客户端使用Internet Explore(IE)8访问文件时,Apache将其作为“application / octet-stream”传送,IE 8将其视为一个.zip文件。

我试图修改httpd.conf来添加types如下:AddType application / vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx

但是Apache仍然把这个文件作为“application / octet-stream”来传递。

还有什么我需要设置,以便Apache可以提供正确的内容types的“application / vnd.openxmlformats-officedocument.spreadsheetml.sheet”的文件?

谢谢

检查是否在/etc/mime.types中正确插入了这个和其他vnd.openxmlformats

application/vnd.openxmlformats-officedocument.presentationml.presentation pptx application/vnd.openxmlformats-officedocument.presentationml.slide sldx application/vnd.openxmlformats-officedocument.presentationml.slideshow ppsx application/vnd.openxmlformats-officedocument.presentationml.template potx application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx application/vnd.openxmlformats-officedocument.spreadsheetml.template xltx application/vnd.openxmlformats-officedocument.spreadsheetml.template xltx application/vnd.openxmlformats-officedocument.wordprocessingml.document docx application/vnd.openxmlformats-officedocument.wordprocessingml.template dotx 

请记住在对mime.types进行任何修改之后重新启动Apache。

Subversion自己检查这个文件是为了确定它是否是一个二进制文件,并且在文件的前1024个字节中,它是基于零和非ASCII字符的自己的(而且非常笨拙的)启发式。

您可以告诉Subversion从具有运行时configuration参数mime-types-file查找MIMEtypes映射。 在Windows机器上,可能会在%APPDATA%\ Subversion下find运行时configuration文件。 在某些安装设置可能在Windowsregistry中,search类似于:

 [HKEY_CURRENT_USER\Software\Tigris.org\Subversion\Config\miscellany] "#mime-types-file"=""