This SO disucssion says that to forward parameters when rewriting an url using return
the code should resemble this
location /path/to/resource {
return 301 /some/other/path/$is_args$args;
}
So far, so good. But how to add an arbitrary new parameter to the query string? For example id=1
.
The solution must cover at least these three cases:
- The original request has no query parameters
- The original request has query parameters, but not the parameter being added
- The original request already has the query parameter being added