在某个目录设置为仅附件上的文件内容处理标头?设置为、附件、文件、目录

2023-09-02 09:49:14 作者:这个人很酷

我有这在我的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.