如何强制浏览器使用.htaccess在目录中下载所有文件类型? [英] How do I force the browser download all file types in a directory using .htaccess?

查看:62
本文介绍了如何强制浏览器使用.htaccess在目录中下载所有文件类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何告诉浏览器强制将所有文件类型下载到目录中,而不是在浏览器中呈现它们?
我已经尝试过了,但是没有用。

How would I tell the browser to force download all file types in a directory instead of rendering them inside the browser? I've tried this but it didn't work.

<Files *.*>
ForceType applicaton/octet-stream
</Files>


推荐答案

我不确定是否可以。但是您可以将mod_rewrite用作.php文件,其文件名位于URL的GET部分中。然后提取文件名,并强制通过该文件名进行下载。如果您想要一些下载代码,只需询问

I'm not sure that is possible. But you can use a mod_rewrite to a .php file with the file name in the GET part of the URL. Then extract the file name and force a download through that. If you want some download code, just ask

这篇关于如何强制浏览器使用.htaccess在目录中下载所有文件类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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