fix($location): links should respect absolute paths and base href when in html5mode

Fixes absolute links on legacy browsers when html5Mode is enabled.

Clicking on a link out of the base's href shouldn't trigger rewriting the URL. This behavior was changed since https://github.com/angular/angular.js/commit/24f7999bc16e347208aa18c418da85489286674b .

This resolves the issue I found on https://github.com/angular/angular.js/commit/24f7999bc16e347208aa18c418da85489286674b#commitcomment-7815179 which has created different behavior when it comes to absolute links on legacy browsers.

Most of this is whitespace changes.
I've added these cases to consider:
1. Properly rewrite links starting with `/base/` when the base tag is present with a value of `/base/`.
2. Don't rewrite links that have a href beginning with `/` not in within the base (i.e. `/outer_base/link`)
3. Don't rewrite links at all if no base tag is present and href begins with `/`
4. Rewrite absolute links with hashbang followed by `/` properly (.i.e. `#!/base/thing`).

This change is meant to resolve those cases that were not tested since 1.2.17 and have mismatching test cases. It's not to add any new features.