nginx: send all requests to a single html page

前端 未结 6 2065
南笙
南笙 2020-11-30 17:45

Using nginx, I want to preserve the url, but actually load the same page no matter what. I will use the url with History.getState() to route the requests in my

6条回答
  •  醉酒成梦
    2020-11-30 18:05

    The correct way would be:

    location / {
        rewrite (.*) base.html last;
    }
    

    Using last will make nginx find a new suitable location block according to the result of rewriting.

    try_files is also a perfectly valid approach to this problem.

提交回复
热议问题