search

Home  >  Q&A  >  body text

url-rewrite - nginx rewrite problem

1、abc.com/goods/123
2. abc.com/#/goods/123

Seeking nginx rewrite writing method

Rewrite the first url to the second url.


Added:

First of all, thank you for your answer. There may be some problems with what I described here. abc.com/goods/123 The goods here may be any address,
1. abc.com/xxx/.../...
2. abc.com/#/xxx/.../...

And when rewriting, it is also necessary to determine whether the url is
in 1. If the url is already of type 2, there is no need to rewrite

The logic should be
Determine whether there is ‘#’
in $request_uri or $uri If there is no ‘#’, rewrite will add ‘#’ to

The question here is whether ‘#’ can be obtained through variables such as $request_uri for judgment
No attempts have been successful so far. . .

滿天的星座滿天的星座2806 days ago539

reply all(1)I'll reply

  • 淡淡烟草味

    淡淡烟草味2017-05-16 17:28:11

    location ^~ /goods/ {
        rewrite ^/goods/(.*) /#/goods/$1 ;
    }
    

    reply
    0
  • Cancelreply