Apache2 服务器 MIME 类型 [英] Apache2 server mime types

查看:28
本文介绍了Apache2 服务器 MIME 类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让我的 Apache2 Web 应用程序在浏览器指向时将任意文件扩展名作为八位字节流推送.

I am trying to get my Apache2 web application to push an arbitrary file extension as an octet-stream when pointed to by a browser.

即有人去 blahblah/examples/example1.xyz 我希望浏览器下载 .xyz 文件而不是仅仅显示它.

i.e. Someone goes to blahblah/examples/example1.xyz I want the browser to download the .xyz file rather than just display it.

我尝试在网络应用程序的根目录中添加 .htaccess,包括

I have tried adding .htaccess in the root of the web app including

AddType application/octet-stream xyz

而且我还尝试将 mime 类型添加到 /etc/apache2/mods-enabled/mime.conf/etc/mime.types 被引用作为 mime.conf 中的类型库.

And I have also tried to add the mime type to /etc/apache2/mods-enabled/mime.conf and /etc/mime.types which is referenced as the types library from mime.conf.

我已经在互联网上阅读了很多关于此的内容,但仍然没有得到解决.任何帮助将不胜感激!谢谢.

I have read a good deal about this on the internet and still haven't gotten this working. Any help would be greatly appreciated! Thanks.

推荐答案

我相信你必须在扩展前添加一个.:

I believe you have to add a . before the extension:

AddType application/octet-stream .xyz

这篇关于Apache2 服务器 MIME 类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆