I deployed my angular application in tomcat, built using ng build --prod --base-href=/myapp/, when i try to access a specific route like http://localhost:8083/myapp/home using [routerLink]="['/home'] it works fine, but when try to refresh the page or access directly http://localhost:8083/myapp/home from the browser, i get HTTP Status 404 The requested resource [/myapp/home] is not available, below is my routing configuration :
const routes: Routes = [
{ path: 'myapp', redirectTo: "/home", pathMatch: "full" },
{ path: 'home', component: HomeComponent }
];
Update :
I've added below configuration in tomcat, and the 404 error is gone, but now when i refresh the page i'm redirected to default route which is myapp, while i'm supposed to be redirected to the current route :
<error-page>
<error-code>404</error-code>
<location>/index.html</location>
</error-page>
index.htmlsince you app is a single page application - Michael Doye