项目上线后,刷新页面报错404 not Found,本地开发及调试可是好好的呀,找了一些资料,这里总结下

1、设置history模式(默认是hash模式,不仅不美观而且还不会重载页面)

在router中的index.js配置文件中把mode:"history"

2、我这边服务器使用的是nginx,配置下nginx即可(如果不配置,当我们访问http://域名/home路径时,就会返回404)

location / {
  try_files $uri $uri/ /index.html;
}

别忘了最后重启下nginx

 

相关文章:

  • 2022-12-23
  • 2021-12-04
  • 2022-12-23
  • 2022-12-23
  • 2021-07-03
  • 2022-12-23
  • 2022-12-23
  • 2021-12-22
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-16
  • 2021-08-14
  • 2022-02-08
  • 2022-12-23
相关资源
相似解决方案