From a few contributions in Stackoverflow (especially this one), I found a solution:
1. Configuring $locationProvider
- This causes the browser running in html5mode, removing the need for adding # to the url
2. Setting the base for relative links
1. Configuring $locationProvider
in the file app.js
angular.module('cineAngularApp', ['ngRoute'])
.config(function ($routeProvider, $locationProvider) {
$routeProvider
.when('/', {
...
});
$locationProvider.html5Mode(true); });
2. Setting the base for relative links
in index.html:<html> <base href="/"> ... </html>Afterwards, I still had the problem that all urls were rewritten with a %2F. This is related to the fact that AngularJS 1.6 has changed the default for hash-bang urls in the$locationservice.Just have to configure $locationProvider to change the behavior (see this post): $locationProvider.hashPrefix('');