nginx multiple domain name rewrite problem
过去多啦不再A梦
过去多啦不再A梦 2017-05-16 17:16:00
0
1
457

1. Request forwarding:

https://abc.*.*/test.do转发至https://efg.*.*/hij/haha/test.do

2. Requirements:

1.abc.*.*与efg.*.*域名对应,如abc.test.com-->efg.test.com, abc.top.com-->efg.top.com
2.转发时追加参数from=testargs

3. nginx configuration

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;
    ……

How to write this kind of rewrite? Thanks.

过去多啦不再A梦
过去多啦不再A梦

reply all(1)
阿神
if ($host ~ abc\.(.*)\.com){
    set $sub_name $1;
    rewrite ^/test.do?(.*) https://efg.$sub_name.com/hij/haha/test.do?$2 permanent;
    }
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!