php - nginx reverse proxy how to handle multiple with rewrite? Request parameter problem
PHP中文网
PHP中文网 2017-05-16 13:12:03
0
1
539

nginx reverse proxy configuration:

This is when I visit lbj.com/faq, it is proxy to lbj.com/index.php?r=index/faq, but because the domain name of the reverse proxy adds request parameters, and then when I use the domain name to add request parameters: lbj.com/faq?xxx=xxx.., because of multiple The request parameters are defined, so this will not take effect and an error will be reported. . (lbj.com/index.php?r=index/faq?xxx=xxx), I want this link to become: lbj.com/index.php?r=index/ How to implement faq&xxx=xxx? I tried some rewrite to rewrite the request parameters I submitted, changing ? into &, but for various reasons I always couldn't get it right. .

PHP中文网
PHP中文网

认证0级讲师

reply all(1)
仅有的幸福

You don’t need to use a reverse proxy for this! You are originally under the same domain name, so just rewrite will be enough

You configure it like this:

location / {
        index  index.php index.html;
        if (!-e $request_filename) {
              rewrite ^/(.*)$ /index.php?r=index? last; 
              break;
        }
}
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template