vue 不同路由模式,部署时,nginx的不同配置
hash模式路由配置如下:
location / {
root font;
index index.html index.htm;
}
history模式路由配置如下:
location / { root font; index index.html index.htm; try_files $uri $uri/ /index.html; # 如果不加此代码,刷新会报404错误,但首次进入主页不会不错 }
hash模式路由配置如下:
location / {
root font;
index index.html index.htm;
}
history模式路由配置如下:
location / { root font; index index.html index.htm; try_files $uri $uri/ /index.html; # 如果不加此代码,刷新会报404错误,但首次进入主页不会不错 }