How to remove index.html from url on website based on angularjs

前端 未结 4 2211
醉梦人生
醉梦人生 2021-02-19 07:21

I didn\'t find a way to remove index.html from the url, because like this looks really ugly.

mydomain.com/index.html#/myview1 
mydomain.com/index.html#/myview2
<         


        
4条回答
  •  南笙
    南笙 (楼主)
    2021-02-19 07:51

    You'll have to do some work on the server side to set this up. html5mode gets you part of the way, but as soon as the user refreshes, the reference to the file will be wrong. You want links that are persistent and can be shared, presumably. Basically make sure any request to url.com/myapp/{etc} (or whatever) gets redirected to index.html and let your angular app sort out the routing.

提交回复
热议问题