对于我的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参数并链接到目标页面中特定锚点的页面?