nginx的配置文件添加如下配置try_files。
location / {
root /www/wwwroot/site;
# 解决刷新404问题
try_files $uri $uri/ /index.html;
}
try_files 在你刷新完页面之后会把地址进行重定向处理,就会去找你的真实页面,找到则显示,找不到时会默认显示index页面。
日 | 一 | 二 | 三 | 四 | 五 | 六 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
nginx的配置文件添加如下配置try_files。
location / {
root /www/wwwroot/site;
# 解决刷新404问题
try_files $uri $uri/ /index.html;
}
try_files 在你刷新完页面之后会把地址进行重定向处理,就会去找你的真实页面,找到则显示,找不到时会默认显示index页面。