0

You can verify by yourself tha's not really a duplicated question !

The problem is clear: I want to remove the # angular urls without HTTP error 404.

www.mondomaine.fr/#/pageX -> www.mondomaine.fr/pageX

/#/PageX -> /pageX

To do this, simply I uses the html5mde (this way):

$LocationProvider.html5Mode (true);

And it works very well :) if I navigate by clicking on the links/buttons/etc in my singlePage :( The problems start when:

  • I type www.mondomaine.fr/pageX => page not found HTTP 404
  • I refresh the page => page not found HTTP 404

I found the explanation but not the solution, good as beginning :-°. When I click on the button pageX on my page, it shows me the good HTML fragment pageX because it is Angular that treats click (~ request), but when I refresh my navigator or I type the URL myselfin the ben browser the request is sent to the server and my back-end, which is a RESTful API, now is not supposed to know process the request HTTP/GET www.mondomaine.fr/pageX. I hope you understand me, there is no hashtag then slap it on the server.

PS: - My back end is a restful API made with JavaEE / spring-boot. - "" is addes in index.html in the beginning of

How to solve this problem? Thank you for your feedback. Thanks

BeliliF
  • 153
  • 1
  • 13
  • You can verify tha's not really a duplicated question ! – BeliliF Sep 14 '16 at 12:21
  • I've re-read it. It really is the same question. You've turned on HTML 5 history mode. Now you have real URLs. Your server 404s when you ask it for those URLs. That is what the other question is asking. The solution is still the same: Get the server to respond with the correct page (or don't use HTML 5 history mode). – Quentin Sep 14 '16 at 13:21

1 Answers1

0

Here is an answer: https://docs.angularjs.org/error/$location/nobase

Did you paste <base href="/">

Michal Kucaj
  • 681
  • 5
  • 15