如何在NgInX中将带有查询字符串的URL重定向到没有查询字符串的URL?

我需要将包含查询字符串的URL重定向/重写为相同的URL,但没有查询字符串.例如http://domain.com/a-post-title/?fbid=xyzhttp://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

相关文章

文章浏览阅读3.7k次,点赞2次,收藏5次。Nginx学习笔记一、N...
文章浏览阅读1.7w次,点赞14次,收藏61次。我们在使用容器的...
文章浏览阅读1.4k次。当用户在访问网站的过程中遇到404错误时...
文章浏览阅读2.7k次。docker 和 docker-compose 部署 nginx+...
文章浏览阅读1.3k次。5:再次启动nginx,可以正常启动,可以...
文章浏览阅读3.1w次,点赞105次,收藏182次。高性能:Nginx ...