Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react-router 指定路由浏览器中单页面刷新404问题 #1

Open
wutianmei opened this issue May 4, 2017 · 0 comments
Open

react-router 指定路由浏览器中单页面刷新404问题 #1

wutianmei opened this issue May 4, 2017 · 0 comments

Comments

@wutianmei
Copy link
Contributor

当直接从页面入口路由逐个点击链接时,没问题

image

当在当前页面刷新浏览器页面时情况如下

image

  • 原因
    nginx会试图在/react/test/snacks目录下找index.html,404是肯定的。此时需要设置一个代理如下

location / {
root "D:/测试";
index index.html index.htm;
}
location /react/test/ {
try_files $uri /react/test/index.html;
root "D:/测试";
}

参考地址: http://yjph83.iteye.com/blog/2311687

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant