【发布时间】:2016-09-08 08:37:46
【问题描述】:
This SO disucssion 表示在使用return 重写 url 时转发参数,代码应类似于此
location /path/to/resource {
return 301 /some/other/path/$is_args$args;
}
到目前为止,一切都很好。但是如何在查询字符串中添加任意新参数呢?例如id=1。
解决方案必须至少涵盖以下三种情况:
- 原始请求没有查询参数
- 原始请求有查询参数,但没有添加参数
- 原始请求中已经添加了查询参数
【问题讨论】:
标签: nginx nginx-location