title: AngularJS $locationProvider.html5Mode not working on localhost
body: <p>I'm trying to get rid of the hashtag that appears in my ui-router URLs. (<a href="http://localhost:3000/email" rel="nofollow">http://localhost:3000/email</a> doesn't work but <a href="http://localhost:3000/#email" rel="nofollow">http://localhost:3000/#email</a> works. After scouring SO, I haven't found a case that works for me. I'm running locally for now, so I assume I don't need any "Server configuration" and I included "" in my index.html. </p>
  
  <pre><code>(function(angular) {
      'use strict';
      angular.module('myApp', ['ui.router'])
  
  
  
      .controller('MainController', function($scope, $route, $routeParams, $location) {
          $scope.$route = $route;
          $scope.$location = $location;
          $scope.$routeParams = $routeParams;
      })
  
      .config([
              ['$stateProvider', '$locationProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider, $locationProvider, $provide) {
  
                  $urlRouterProvider.otherwise('/email');
  
                  // PAGES
  
                  $stateProvider
  
                      .state('email', {
                      url: '/email',
                      templateUrl: '../pages/email.html',
                      controller: 'EmailController'
                  })
  
                  .state('about', {
                      url: '/about',
                      templateUrl: '../pages/about.html',
                      controller: 'AboutController'
                  })
  
                  // ... the rest...
  
                  $locationProvider
                      .html5Mode(true); // enable html5Mode for pushstate ('#'-less URLs DOESN'T WORK)
                      .hashPrefix('!');
  
                  $provide.decorator('$sniffer', function($delegate) {
                      $delegate.history = false;
                      return $delegate;
                  });
  
              }]);
  </code></pre>