@@ -330,22 +330,37 @@ reload to the original link.
330
330
### Relative links
331
331
332
332
Be sure to check all relative links, images, scripts etc. Angular requires you to specify the url
333
- base in the head of your main html file (`<base href="/my-base">`) unless `html5Mode.requireBase` is
334
- set to `false` in the html5Mode definition object passed to `$locationProvider.html5Mode()`. With
333
+ base in the head of your main html file (`<base href="/my-base/index.html ">`) unless `html5Mode.requireBase`
334
+ is set to `false` in the html5Mode definition object passed to `$locationProvider.html5Mode()`. With
335
335
that, relative urls will always be resolved to this base url, even if the initial url of the
336
336
document was different.
337
337
338
338
There is one exception: Links that only contain a hash fragment (e.g. `<a href="#target">`)
339
339
will only change `$location.hash()` and not modify the url otherwise. This is useful for scrolling
340
340
to anchors on the same page without needing to know on which page the user currently is.
341
341
342
+
342
343
### Server side
343
344
344
345
Using this mode requires URL rewriting on server side, basically you have to rewrite all your links
345
346
to entry point of your application (e.g. index.html). Requiring a `<base>` tag is also important for
346
347
this case, as it allows Angular to differentiate between the part of the url that is the application
347
348
base and the path that should be handled by the application.
348
349
350
+ ### Base href constraints
351
+
352
+ The `$location` service is not able to function properly if the current URL is outside the URL given
353
+ as the base href. This can have subtle confusing consequencies...
354
+
355
+ Consider a base href set as follows: `<base href="/base/">` (i.e. the application exists in the "folder"
356
+ called `/base`). The URL `/base` is actually outside the application (it refers to the `base` file found
357
+ in the root `/` folder).
358
+
359
+ If you wish to be able to navigate to the application via a URL such as `/base` then you should ensure that
360
+ you server is setup to redirect such requests to `/base/`.
361
+
362
+ See https://github.com/angular/angular.js/issues/14018 for more information.
363
+
349
364
### Sending links among different browsers
350
365
351
366
Because of rewriting capability in HTML5 mode, your users will be able to open regular url links in
0 commit comments