1

I have an AngularJS website based on Firebase. I have managed to remove the # prefix and reqrite urls like /#/home to /home, using the code below:

.config(['$routeProvider', '$locationProvider', function ($routeProvider, $locationProvider) {
    $routeProvider.otherwise({
      redirectTo: '/home'
    });
    if(window.history && window.history.pushState){
      $locationProvider.html5Mode({
          enabled: true,
          requireBase: false
      });
    }
  }])

however, the existing anchors create problems. When I click on <a href="#/faq">FAQ</a>, it takes me to /home#%2Ffaq Of course, I can change the href of some anchors, but do not see that as a solution, as there might be some links somewhere that remain unchanged and get broken.

How do I resolve this issue without breaking the existing links?

georgeawg
  • 48,608
  • 13
  • 72
  • 95
towi_parallelism
  • 1,421
  • 1
  • 16
  • 38
  • @georgeawg, that's a different problem. My problem is not with the `%2F` part, but the fact that `#/xxx` is appended to the current location e.g. `/home`, because of the migration from html4 to html5. My existing links still use `#/xxx` format, which will not work after enabling html5 – towi_parallelism Jun 23 '18 at 12:06
  • Possible duplicate of [AngularJS All slashes in URL changed to %2F](https://stackoverflow.com/questions/41272314/angularjs-all-slashes-in-url-changed-to-2f). – georgeawg Jun 23 '18 at 13:06

0 Answers0