在某个目录设置为仅附件上的文件内容处理标头? [英] Set Content-Disposition header to attachment only on files in a certain directory?

查看:209
本文介绍了在某个目录设置为仅附件上的文件内容处理标头?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这在我的htaccess的文件,以强制链接的文件下载,而不是开在浏览器中的规则:

I've got this this rule in my htaccess file to force linked files to download rather than open in the browser:

<FilesMatch "\.(gif|jpe?g|png)$">
  ForceType application/octet-stream
  Header set Content-Disposition attachment
</FilesMatch>

有没有办法改变正则表达式,因此仅适用于文件中的某个目录?\

Is there a way to alter the RegExp so it only applies to files in a certain directory?\

感谢

推荐答案

您可能需要把指令中的.htaccess文件中的特定目录。

You will probably need to put the directives in the .htaccess file in the particular directory.

这篇关于在某个目录设置为仅附件上的文件内容处理标头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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