【问题标题】:How i can redirect an url with query string to the url without query string in NgInX?如何在 NgInX 中将带有查询字符串的 url 重定向到没有查询字符串的 url?
【发布时间】:2012-10-09 14:33:52
【问题描述】:

我需要将包含查询字符串的 url 重定向/重写到相同的 url,但没有查询字符串。例如http://domain.com/a-post-title/?fbid=xyzhttp://domain.com/a-post-title/ 对不起我的英语不好。

【问题讨论】:

    标签: redirect nginx rewrite


    【解决方案1】:

    简单,只需在重写结束时添加?, 来自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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-06-17
      • 2015-03-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-12-14
      相关资源
      最近更新 更多