当我在tomcat中部署我的Angular应用程序时,它在URL中创建了两个文件夹名,导致404错误

问题描述

当我在tomcat中部署我的angular应用程序时,它在URL中创建了两个文件名,导致404错误。我使用了ng build --base-href = usersfront命令。请帮助我解决这个问题。

enter image description here

解决方法

按照下面的步骤

  1. ng build --base-href=/userfront/
  2. 成功构建项目后
  3. 在tomcat userfront中创建web-apps文件夹,并将所有文件(html,css和js)从dist文件夹复制到userfront文件夹。
  4. 然后尝试使用此网址http://localhost:8080/userfront/index.html