How to set base url in angular 6 app (getting 404 page after refreshing)?


I have followed the below procedure.

  1. ng build –base-href=/myapp/
  2. Deployed into the tomcat server
  3. Accessing: http://localhost:8080/myapp/ (open home page)

After refreshing the home page, it is giving a 404 error page.


try using HashLocationStrategy. Put useHash: true while defining your routes:

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

Answered By – Abdul Rafay

Answer Checked By – Mildred Charles (AngularFixing Admin)

Leave a Reply

Your email address will not be published.