用于文件下载的Apache指令 [英] Apache directive for file downloads
本文介绍了用于文件下载的Apache指令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在 .htaccess
文件中创建Apache指令,以强制 .mp4
和 .pdf
下载?当前,它们出现在浏览器窗口中。相反,我希望显示一个下载文件对话框。
How do I create Apache directives in a .htaccess
file that forces .mp4
and .pdf
to download? Currently they appear within the browser window. Instead, I would like a download file dialog box to appear.
推荐答案
将以下内容添加到.htaccess文件中:
Add the following into an .htaccess file:
<Files *.mp4>
ForceType application/octet-stream
Header set Content-Disposition attachment
</Files>
<Files *.pdf>
ForceType application/octet-stream
Header set Content-Disposition attachment
</Files>
这篇关于用于文件下载的Apache指令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文