问题描述
1、请求转发:
https://abc.*.*/test.do转发至https://efg.*.*/hij/haha/test.do
2、要求:
1.abc.*.*与efg.*.*域名对应,如abc.test.com-->efg.test.com, abc.top.com-->efg.top.com2.转发时追加参数from=testargs
3、nginx配置
server{ listen 443; server_name abc.test.com; server_name abc.top.com; server_name res.abc.top.com; server_name abc.77676.com; server_name abc.446464.com; server_name abc.46464.com; server_name abc.787873.com; ……
这种rewrite要怎么写?谢谢。
问题解答
回答1:if ($host ~ abc.(.*).com){ set $sub_name $1; rewrite ^/test.do?(.*) https://efg.$sub_name.com/hij/haha/test.do?$2 permanent; }