Ich habe ein Problem mit der Umleitung meiner App im Produktionsmodus. wenn ich url haben http://server.com/projectname/dashboard
, Serverantwort IIS Fehlerseite 404. I App http://server.com/projectname
mit öffnen müssen, und klicken Sie dann auf den Link zum Beispiel:Angular Routing - Umleitung URL zu Komponente
<a [routerLink]="'dashboard'">Dashboard</a>
In html Ich habe <base href="./">
und das ist mein 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)
]
})
Im Entwicklungsmodus habe ich URL http://localhost:4200/dashboard
und ich sollte umleiten. Kann es ein Problem sein, wenn in der Entwicklung ist URL localhost: 4200/Dashboard und in der Produktion ist server.com/ Appname/Dashboard?