Description of the problem: When the application is developed, use the angular-cli ng-build file to package the file, generate the dist folder, and upload it to the server. When you redirect to the corresponding routing interface, a 404 will appear. It seems that the routing did not work.

Solution: Simply convert the route to a hash: userHash: true, and convert the route to a “#” sign

Hash routing form: “http://localhost:4200/#/ng2”

When registering a route in a module, just add {useHash: true}.

imports: [
    RouterModule.forRoot(myRouter, {useHash: true})
],