Home  >  Q&A  >  body text

Pseudo-static - nginx rules help

There is now a website that uses Baidu siteapp automatic transcoding service. Now it has developed its own mobile terminal. However, before, Baidu used automatic jumps to access the mobile terminal.

The current problem is how to make the previous access link automatically jump to the new link.

The transcoding link of Baidu siteapp is:
http://m.xxx.com/?src=http://www.xxx.com/north-america/america/2010/05...

Replace this part http://m.xxx.com/?src=http://www.xxx.com/ with http://m.xxx.com/

through nginx rules

In this way, when users search for the content of this site through m.baidu.com, they can jump directly from the old url to the new url.

Can the above replacement function be implemented through nginx rules? Please help me heroes. Many thanks.

天蓬老师天蓬老师2713 days ago460

reply all(2)I'll reply

  • 黄舟

    黄舟2017-05-16 17:25:22

    nginxserver {
        server_name m.xxx.com;
        location / {
            if ($args ~* "src=.*$") {
                rewrite ^ $arg_src? permanent;
            }
        }
    }
    

    reply
    0
  • 習慣沉默

    習慣沉默2017-05-16 17:25:22

    The test was successful, thank you for your help!

    reply
    0
  • Cancelreply