title: AngularJS 1.0.7 in html5Mode get 404 error when refresh page part 2 new error
body: <p>this is related to <a href="https://stackoverflow.com/questions/28611396/angularjs-1-0-7-in-html5mode-get-404-error-when-refresh-page">AngularJS 1.0.7 in html5Mode get 404 error when refresh page</a> . But, actually the problem I depicted in that post is fixed, but after that, new errors has come. So, I have marked the previous one as ok, and I will explain my new error:</p>
  
  <p>To summarize, page refresh is now working, however some functionalities related to links have stopped working. I post an example code:</p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>   &lt;li ng-show="logged" class="dropdown"&gt;       
          &lt;a href="#" class="dropdown-toggle" data-toggle="dropdown" style="padding-top: 10px; padding-bottom: 5px"&gt;
              &lt;img ng-show="user.mainPhoto" src="//{{S3_BUCKET}}.{{PHOTO_SERVER_URL}}/img/users/{{user.id}}/{{user.mainPhoto.id}}.{{user.mainPhoto.mime}}" style="height: 30px; width: 30px;" class="img-circle"/&gt;
              &lt;i ng-hide="user.mainPhoto" class="fa-icon-user" style="font-size: 22px;margin-right: 5px"&gt;&lt;/i&gt;
              {{user.name}}
              &lt;span class="badge" style="background-color: rgb(41, 169, 223)" ng-show="userAlerts.length &gt; 0"&gt;{{userAlerts.length}}&lt;/span&gt; 
              &lt;b class="caret" style="margin-top: 14px"&gt;&lt;/b&gt;
          &lt;/a&gt;
          &lt;ul class="dropdown-menu"&gt;
            &lt;li&gt;&lt;a href="#" tabindex="-1" ng-click="goToProfile()"&gt;{{'PROFILE' | translate}}&lt;/a&gt;&lt;/li&gt;
            &lt;li class="divider"&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a tabindex="-1" href="" ng-click="logout()"&gt;{{'LOGOUT' | translate}}&lt;/a&gt;&lt;/li&gt;
          &lt;/ul&gt;                                       
      &lt;/li&gt;
  </code></pre>
  
  <p><strong>JS</strong></p>
  
  <p>login.js</p>
  
  <pre><code>$scope.goToProfile = function(){
      $location.search({});
      $location.path('/user-dashboard');
  };
  </code></pre>
  
  <p>app.js:</p>
  
  <p>angular.module('myApp', ['myApp.filters', 'myApp.services', 'myApp.directives', 'myApp.controllers'])
    .config(['$routeProvider', '$httpProvider', '$locationProvider',function($routeProvider, $httpProvider, $locationProvider) {</p>
  
  <pre><code>// use the HTML5 History API
  $locationProvider.html5Mode(true);   
  
  $httpProvider.defaults.useXDomain = true;
  delete $httpProvider.defaults.headers.common["X-Requested-With"];           
  
  $routeProvider.when('/', {templateUrl: 'partials/home.html', controller: 'HomeCtrl'});      
  $routeProvider.when('/about', {templateUrl: 'partials/about.html', controller: 'AboutCtrl'});    
  $routeProvider.when('/contact', {templateUrl: 'partials/contact.html', controller: 'HomeCtrl'});
  $routeProvider.when('/home', {templateUrl: 'partials/home.html', controller: 'HomeCtrl'});
  $routeProvider.when('/user-dashboard', {templateUrl: 'partials/user-dashboard.html', controller: 'UserDashboardCtrl'});       
  $routeProvider.when('/user-dashboard#tabProfile', {templateUrl: 'partials/user-dashboard.html#tabProfile', controller: 'UserDashboardCtrl'});
  $routeProvider.otherwise({redirectTo: '/'}); 
    }])
  </code></pre>
  
  <p>Nginx config file (only relevant part):</p>
  
  <pre><code>server {
          listen       80;
          server_name  localhost;
  
          #charset koi8-r;
          access_log  logs/host.access.log;
          rewrite_log on;
          location / {
              root   /Users/Rober/Projects/yanpy/dev/yanpy/app;
              index  index.html index.htm;
              try_files $uri $uri/ /index.html =404;
          }
  </code></pre>
  
  <p>When I click on the link that goToProfile, to navigate to user dashboard, I´m just redirected to index. Note: For other links or actions is navigating correctly.</p>