After Ionic4 / Angular Web project packaged, deployed to the server, refresh access 404 Solution
Project uses Ionic4 / Angular8 development, using Angular routing through
ionic build --prod
Compile and publish content under www directory to IIS, access in the browser (http: //domain/index.html automatically jump to http: // domain / tabs / func ), then click on Browse refresh button at the top of the device 404 issues appeared, the solution is to use a hash routing, allowing access address becomes http: // domain / # / tabs / func, the specific implementation is to modify app.module.ts
1, in the first increase beginning position following code:
import { LocationStrategy, HashLocationStrategy } from '@angular/common';
2, modify @NgModule code, add the following:
@NgModule({
providers: [
{ provide: LocationStrategy, useClass: HashLocationStrategy }
]
})