I'm currently developing an application that requires the use of HTML 5 mode. The challenge I am facing is that as I transition an existing website to AngularJS 1.2, I need to eliminate '#' tags from my URLs. Below is my current configuration:
angular.module('myApp', ['ngRoute']).
config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) {
$locationProvider.html5Mode(true);
$routeProvider
.when("/home", {templateUrl:'home.html', controller:'homeController'})
// other routes are defined here..
.otherwise({redirectTo: '/home'});
}]);
The issue arises when I try to access 'http://myServer/home' with HTML 5 mode enabled. It results in a 404 error. Strangely enough, if I visit 'http://myServer/', the app works fine. It seems that deep-linking fails to work properly when html5 mode is turned on. Disabling the line "$locationProvider.html5mode(true);" allows the site to function, but it's not a viable solution since I need to avoid hash tags in the URL during the migration process.
Am I missing something about how html5mode(true) operates? Or could there be an error in my implementation?
Thank you