php - nginx反向代理如何用rewrite处理多个?的请求参数问题
PHP中文网
PHP中文网 2017-05-16 13:12:03
0
1
478

nginx反向代理配置:

这个是当我访问lbj.com/faq时代理到lbj.com/index.php?r=index/faq的处理,但是因为反向代理的域名是加了请求参数的,然后再当我使用域名加请求参数:lbj.com/faq?xxx=xxx..时因为因为多重定义了请求参数所以这个并不会起效还会报错。。(lbj.com/index.php?r=index/faq?xxx=xxx),我想让这个链接变成:lbj.com/index.php?r=index/faq&xxx=xxx该怎么实现呢?我试了一些rewrite重写我提交的请求参数吧?更改成&,但是种种原因总是不得其法。。

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!