Using Angular 2 RC 4 with the updated @angular/router, I got the route URLs to display in the browser using the answer in this question
However, when I refresh or directly request a page with a route other than the default, it takes me to the default page (as if I requested index.html) rather than the routed page I want. How can I make the Angular 2 routes work correctly on a page refresh with Apache 2.4?
Routes and bootstrap:
const routes: RouterConfig = [
{ path: '', redirectTo: 'dashboardTab', terminal: true },
{ path: 'dashboardTab', component: DashboardComponent },
{ path: 'missionTab', component: MissionComponent, children: childRoutes }];
bootstrap(NavbarComponent, [disableDeprecatedForms(), provideForms(), provideRouter(routes), {provide: Window, useValue: window}, HTTP_PROVIDERS, ResponsiveState, {provide: PLATFORM_DIRECTIVES, useValue: RESPONSIVE_DIRECTIVES, multi: true}]).catch((err: any) => console.error(err));
base href in index.html:
<base href="/">
<base>tag inindex.html,bootstrap(...), ...terminal: trueshould bepathMatch: 'full'in the most recent version. If it runs with lite-server but not with Apache then your Apache is not configured to support HTML5 pushState. You can try switching toHashLocationStrategyto verify it. If this works, it's a server configuration issue.