【发布时间】:2012-10-09 14:33:52
【问题描述】:
我需要将包含查询字符串的 url 重定向/重写到相同的 url,但没有查询字符串。例如http://domain.com/a-post-title/?fbid=xyz 到http://domain.com/a-post-title/ 对不起我的英语不好。
【问题讨论】:
我需要将包含查询字符串的 url 重定向/重写到相同的 url,但没有查询字符串。例如http://domain.com/a-post-title/?fbid=xyz 到http://domain.com/a-post-title/ 对不起我的英语不好。
【问题讨论】:
简单,只需在重写结束时添加?,
来自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
【讨论】: