I need to redirect/rewrite an url that contains query string to the same url, but without query string. For example http://domain.com/a-post-title/?fbid=xyz to http://domain.com/a-post-title/ Sorry for my bad english.
1 Answer
Easy, just put a ? at the end of your rewrite,
from http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite:
If a replacement string includes the new request arguments, the previous request
arguments are appended after them. If this is undesired, putting a question mark at the
end of a replacement string avoids having them appended