【发布时间】:2016-08-31 15:21:25
【问题描述】:
我的服务器上有随机名称的图像(例如“8a4f5d61.jpg”),我需要使用给定的 GET 参数更改这些文件的名称。
如果我有这样的网址:
我希望 Apache 添加这样的标题:
标头内容处置:“附件,文件名=$_GET['附件']”
所以用户将下载这个已经重命名为“custom_name.jpg”的文件。
我不知道如何从 .htaccess 中获取 GET 参数
在 nginx 上这很简单,这是我的工作 nginx 配置:
location ~ ^/.*\.jpg$ {
if ($arg_inline) {
add_header Content-Disposition "inline; filename=$arg_inline";
}
if ($arg_attachement) {
add_header Content-Disposition "attachement; filename=$arg_attachement";
}
}
使用 .htaccess 在 Apache 上是否可以实现?
【问题讨论】:
标签: apache .htaccess http-headers response-headers