Angualr5 sets routing url

package the angular code and upload it to the server. Refresh will report 404
Baidu, and add

to aap.model.ts.
   providers: [{ provide: LocationStrategy, useClass: HashLocationStrategy, }]

although it can solve the problem, it is added after url-sharp, generally does not have this. The home page shows a main domain name. Is there any other way to refresh without 404? For example, server configuration mapping and so on, the server I use is tomcat

Mar.10,2021

this is not a matter of server configuration mapping, it has nothing to do with the server. Yours is a single-page application, which involves routing. For more information, please see this article: https://codeshelper.com/a/11.


tomactweb.xmlangularhtml5

<error-page>
    <error-code>404</error-code>
    <location>/</location>
</error-page>
Menu