I have a problem with redirect my app in production mode. when I have url http://server.com/projectname/dashboard, server response IIS error page 404. I must open app using http://server.com/projectname and then click on link for example:
<a [routerLink]="'dashboard'">Dashboard</a>
In html i have <base href="./"> and this is my router:
const appRoutes: Routes = [
{ path: '', redirectTo: 'dashboard', pathMatch: 'full', canActivate: [AuthGuard] },
{ path: 'dashboard', component: DashboardComponent, canActivate: [AuthGuard]},
{ path: '400', component: ErrorComponent, canActivate: [AuthGuard] },
{ path: '401', component: ErrorComponent, canActivate: [AuthGuard] },
{ path: '404', component: ErrorComponent, canActivate: [AuthGuard],
{ path: '**', redirectTo: '/404' }
]
@NgModule({
imports: [
RouterModule.forRoot(appRoutes)
]
})
In development mode I have url http://localhost:4200/dashboard and i should redirect. Can it be problem when in developing is url localhost:4200/dashboard and in production is server.com/appname/dashboard?