Search code examples
angularwebserversingle-page-application

Angular project not rerouting on refresh


I am serving my Angular project built with CLI using the local-web-server module.

The instructions state to use the command --spa followed by the name of your single page. This works fine on a refresh, except for pages where there are parameters being passed into the URL for example: detail/1. If I try and refresh this type of page my JavaScript and CSS files get a 404 error.


Solution

  • What fixed the issue was within my index.html file. I had changed the base href to ./ Changing it back to the original / fixed the issue.