I already did $locationProvider.html5Mode(true); but it does not work. Whenever I access http://example.com , it goes to http://example.com/#!/ . The code is given here:
var myApp = angular.module('myApp', ['ui.router', 'ui.bootstrap']); myApp.config(['$qProvider', function ($qProvider) { $qProvider.errorOnUnhandledRejections(false); }]); myApp.config(function($stateProvider, $urlRouterProvider,$locationProvider) { // For any unmatched url, redirect to EXTRANET home page $urlRouterProvider.otherwise('/'); // Now set up the states $stateProvider .state('listrole', { url: "/list-role", views: { 'main-content': { templateUrl: rootUrl+ 'views/main.html', controller: 'rolesCtrl' } } }) $locationProvider.hashPrefix(''); $locationProvider.html5Mode(true); });
Update I added $locationProvider.hashPrefix(''); but no difference. Also let me tell you that I enter the address in the address bar and press enter. Am I doing the right thing? How does the browser detect that it does not need to be updated from the server?
Update # 2
Ideally, I want a URL like http://example.com and http://example.com/#!/list-role to http://example.com/list-role . Right now http://example.com/list-role gives 404
Update # 3
I use nginx proxy if that helps.
Update # 4
Remote cache. Now I can see http://example.com instead of http://example.com/#! but still http://example.com/list-role gives 404
source share