我需要将包含查询字符串的 url 重定向/重写到相同的 url,但没有查询字符串。例如http://domain.com/a-post-title/?fbid=xyz到http://domain.com/a-post-title/ 对不起我的英语不好。
问问题
1286 次
1 回答
3
很简单,只需?
在重写的末尾加上一个,来自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
于 2012-10-09T15:19:22.960 回答