As mzulch said, you need a server that can redirect a URL that is not found in index.html. You are not loading the url because the angular router is not loading when you enter this url. Thus, it cannot intercept requests, and the browser displays 404 not found error. lite-server is an ideal server for testing during development.
During production, you can configure the nginx server to redirect all 404 requests to index.html, and then the responsibility of your angular router to handle real 404
In the nginx configuration, you can define this as follows:
server { error_page 404 =200 /index.html
This will redirect the entire 404 error to your index.html and convert the 404 error code to 200.
source share