Home  >  Q&A  >  body text

Looking for a nginx rewrite rule?

Want to do a rewrite

Only when the address is http://www.xxxx.com/bbs/, rewrite to http://www.xxx.com/bbs/welcom...
If it is http://www .xxxx.com/bbs/index...or other links under /bbs/ will not be rewritten, and they will still go by

location /bbs/ {

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

}

This is currently written, but http://www.xxx.com/bbs/?a=d and the like will be rewritten accordingly. Can it be rewritten only when the url is in the rules? ? ? ?

我想大声告诉你我想大声告诉你2713 days ago445

reply all(1)I'll reply

  • 黄舟

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

    Just put the rules of /bbs/index before the rules of /bbs.

    reply
    0
  • Cancelreply