具有特定扩展名的Apache下载文件 [英] Apache download files with specific extension
问题描述
我对Apache网络服务器下载目录。该目录中的文件具有特定扩展。例如* .yyy和* .zzz。但所有这些文件被重命名的.zip或.tar.gz
我在不同的brawsers测试,并没有带什么烦心的事。
但是,一些用户告诉他们得到包的来源,而不是下载。
我已经created.htaccess
将AddType应用程序/压缩.zzz
将AddType应用程序/ x-gzip的.yyy
但是,当我尝试在微软浏览器aaa.yyy下载它试图挽救不AAA级。 YYY ,但AAA。 GZ
如何强制浏览器下载文件,而不是改变扩展?
< FilesMatch\\(ZZZ | YYY)$。>
ForceType指令的应用程序/八位字节流
头中设置内容处置附件
< / FilesMatch>
力型告诉你不知道的文件类型的浏览器。因此,他们不会做任何愚蠢的事。第二条线会告诉他们下载此文件。
I have download directory on apache webserver. Files in this directory have specific extensions. For example *.yyy and *.zzz. But all these files are renamed .zip or .tar.gz
I've tested in different brawsers and havn't got any problems.
But some users tell that they get source of packages, not download.
I've created.htaccess
AddType application/zip .zzz
AddType application/x-gzip .yyy
But when I try to download aaa.yyy in MS Internet Explorer it try to save not aaa.yyy but aaa.gz
How to force browsers download files and not to change extensions?
<FilesMatch "\.(zzz|yyy)$">
ForceType application/octet-stream
Header set Content-Disposition attachment
</FilesMatch>
Force type tell browsers that you dont know file type. So they are not going to do any thing stupid. Second line will tell them to download this file.
这篇关于具有特定扩展名的Apache下载文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!