0

Since upgrading to AngularJS 1.6, hashbangs are defaulted.

How would I redirect formerly distributed URLs to transform to a version with the hashbang?

For example www.myu.rl/#/hello/ would then become www.myu.rl/#!/hello

Currently it navigates to www.myu.rl/#!#%2F/hello, which redirects to the home page.

Tom
  • 869
  • 6
  • 25
  • You can use interceptors for this: https://djds4rce.wordpress.com/2013/08/13/understanding-angular-http-interceptors/ – Mike Cheel Mar 09 '17 at 13:37
  • @MikeCheel doesn't look like it. `config.url` doesn't contain the base URL. – Tom Mar 09 '17 at 13:45

1 Answers1

0

If you want to keep the hash-bang mode (#!/), then set your hash-prefix to:

$location.hashPrefix('!');

If you would like to go back to the good ol' days, see this answer.

Community
  • 1
  • 1
Mistalis
  • 17,793
  • 13
  • 73
  • 97
  • Doesn't work, unfortunately. URL `myu.rl/#/hello` doesn't become `myu.rl/#!/hello`, but redirects to the home page by going to `myu.rl/#!#%2Fhello`. – Tom Mar 09 '17 at 14:01
  • @Tom Could you try `$locationProvider.hashPrefix('!');` instead? – Mistalis Mar 09 '17 at 14:04
  • that's what I tried. Unfortunately it doesn't work. Appreciate it anyways. – Tom Mar 09 '17 at 14:09