I have the following HTML page:
<!DOCTYPE html>
<html>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-route.js"></script>
<body ng-app="myApp">
<p><a href="/">Main</a></p>
<a href="first">City 1</a>
<a href="#first">City 1a</a>
<div ng-view></div>
<script>
var app = angular.module("myApp", ["ngRoute"]);
app.config(function($routeProvider) {
$routeProvider
.when("/first", {
templateUrl : "first.html"
})
.when("/first", {
templateUrl : "first.html"
});
});
</script>
</body>
</html>
Then there is a simple first.html page.
Now, my City1a link works and angularJS loads properly the page into <div ng-view></div>. Instead, city1 link does not work and I have a 404 error.
When one clicks on City1a my URL is http://localhost/myproject/index.html#/first. What can I do to turn the URL in http://localhost/myproject/first?