Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 2\4 hash url keep index.html

Tags:

angular

Background: Angular 4, ng cli, RouterModule, useHash: true.

when I browse to my app using http://server/index.html it resolves to http://server/#/ (index.html is omitted from the url) additionally every routing navigation also omits the index.html from the url.

This is problematic for how my app is hosted, I need to keep index.html in the url. How can I configure angular to keep it?

like image 207
itaysk Avatar asked Feb 04 '23 05:02

itaysk


1 Answers

You can try:

ng build --prod --base-href /app/index.html

but it might affect relative path to your assets.

like image 192
Q.Z Avatar answered Feb 07 '23 13:02

Q.Z