【发布时间】:2016-01-16 05:29:12
【问题描述】:
所以我在 htaccess 中使用以下规则:
AddType SCHM wsc
<FilesMatch "\.(wsc)$">
ForceType SCHM
Header set Content-Disposition attachment
</FilesMatch>
但是当我转到file's location 时,它不会强制下载
【问题讨论】:
-
您使用的是哪个浏览器?我的 Chromium 45 下载文件
-
我使用的是 Chrome,但其他网站上的 similar file 对我有用,但我的 ftp 上的那个只是在浏览器中显示二进制文件
-
也许您还应该将
Content-Type设置为application/octet-stream。我想有人会这样想:Header set Content-Type application/octet-stream -
@JojOatXGME 我试过但没用
-
好的,因为它已经在我的电脑上工作了,我不知道为什么它不适合你。如果我的文件已经在缓存中,我已经看到服务器响应“未修改”。也许您的浏览器只是缓存文件并且不知道您已添加此标头条目。在这种情况下,只有文件的较新修改日期才会导致浏览器重新加载。您可以在 Linux 的 shell 中使用
touch <filename>来更改时间戳。