nginx:将所有请求发送到单个 html 页面 [英] nginx: send all requests to a single html page
本文介绍了nginx:将所有请求发送到单个 html 页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用nginx,我想保留url,但无论如何实际上加载相同的页面.我将使用带有 History.getState()
的 url 在我的 javascript 应用程序中路由请求.看起来应该是一件很简单的事情吧?
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 javascript app. It seems like it should be a simple thing to do?
location / {
rewrite (.*) base.html break;
}
工作,但重定向 url?我还需要网址,我只想一直使用同一个页面.
works, but redirects the url? I still need the url, I just want to always use the same page.
推荐答案
我认为这对你有用:
location / {
try_files /base.html =404;
}
这篇关于nginx:将所有请求发送到单个 html 页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文