首页  >  问答  >  正文

求一个nginx的rewrite规则?

想做一个重写

仅当地址是http://www.xxxx.com/bbs/时,重写到http://www.xxx.com/bbs/welcom...
如果是http://www.xxxx.com/bbs/index...或其他/bbs/下的链接都不重写,照旧走路由

location /bbs/ {

if ( $uri = '/bbs/' ) {
    rewrite ^(.*) http://www.xxx.com/bbs/welcome.html $last
}

}

目前这样写的,但对http://www.xxx.com/bbs/?a=d之类的就跟着重写了,能否仅仅只有url是规则里的时候才重写????

我想大声告诉你我想大声告诉你2713 天前442

全部回复(1)我来回复

  • 黄舟

    黄舟2017-05-16 17:16:41

    把/bbs/index的规则放在/bbs的规则之前就可以了吧。

    回复
    0
  • 取消回复