0

After deploying angular 4 projects have routes on Apache server or any server. When request http://example.com/ the project runs successfully. when a refreshing browser, any link does not default for example http://example.com/news/ returns error404. I need to solve this problem.

Thanks in advance.

brijmcq
  • 3,354
  • 2
  • 17
  • 34

1 Answers1

0

As @Wasif Khan said, you can try with the hash in the URL, if the route works with the hash, then you could probably set the option "useHash" to false in your routing file.

@NgModule({ imports: [ RouterModule.forRoot(routes, {useHash: false}) ], exports: [ RouterModule ] })