【发布时间】:2019-11-05 17:21:17
【问题描述】:
对于我的 www.example.com nginx 配置,我有这些重写规则:
rewrite ^/foo$ https://one.example.com/page#one permanent;
rewrite ^/foo(\?.*)$ https://two.example.com/page$1#two permanent;
rewrite ^/bar$ https://three.example.com/page#one permanent;
rewrite ^/bar\?(.*)$ https://four.example.com/page?$1#two permanent;
对http://www.example.com/foo 的请求正确重定向到https://one.example.com/page#one。
对http://www.example.com/bar 的请求正确重定向到https://three.example.com/page#one。
对http://www.example.com/foo?extra=yes 的请求不正确 重定向到https://one.example.com/page#one?extra=yes(我希望它转到https://two.example.com/page?extra=yes#two)。
对http://www.example.com/bar?extra=yes 的请求不正确 重定向到https://three.example.com/page#one?extra=yes(我希望它转到https://four.example.com/page?extra=yes#two)。
如何重定向到复制 CGI 参数并链接到目标页面中特定锚点的页面?
【问题讨论】:
标签: nginx url-rewriting