问题:tomcat部署了react前端项目,可以正常访问,但是页面刷新就报404

一、问题截图

tomcat 部署 React 项目后,浏览器刷新报404问题

 

 

二、解决办法

在tomcat 配置文件web.xml中配置如下代码:

  web.xml 路径: apache-tomcat-8.5\conf\web.xml

<error-page>
    <error-code>404</error-code>
    <location>/index.html</location>
</error-page>

如图:

  tomcat 部署 React 项目后,浏览器刷新报404问题

 

相关文章:

  • 2021-08-14
  • 2021-04-20
  • 2022-01-16
  • 2021-05-31
  • 2022-12-23
  • 2022-12-23
  • 2021-08-05
猜你喜欢
  • 2022-12-23
  • 2021-07-15
  • 2022-12-23
  • 2022-12-23
  • 2021-09-05
  • 2022-12-23
  • 2021-12-16
相关资源
相似解决方案