title: Getting 404 page on refresh on AngularJS site?
body: <p>I am getting a served the 404 page whenever I : </p>
  
  <p><strong>1.)</strong> refresh any page on my Angularjs site <em>(besides the root page)</em> </p>
  
  <p><em>or</em></p>
  
  <p><strong>2.)</strong> click <strong>Back</strong> to go from a 404 page to the root page <em>(the root page will be a 404)</em></p>
  
  <p>Here is my <code>.config()</code> code</p>
  
  <pre><code>'use strict';
  
  angular.module('mmApp', ['ngResponsiveImages'])
    .config(function ($locationProvider, $routeProvider) {
      $locationProvider.html5Mode(true);
      $locationProvider.hashPrefix = '!';
      $routeProvider
        .when('/', {
          templateUrl: '/views/design.html',
          controller: 'MainCtrl'
        })
        .when('/about', {
          templateUrl: '/views/about.html',
          controller: 'MainCtrl'
        })
        .when('/contact', {
          templateUrl: '/views/contact.html',
          controller: 'MainCtrl'
        })     
        .otherwise({
          redirectTo: '/'
        });
    });
  </code></pre>
  
  <p>I have come across this similar question but do not quite understand the answers or how to implement them.</p>
  
  <p><a href="https://stackoverflow.com/questions/15250090/angularjs-why-when-changing-url-address-routeprovider-doesnt-seem-to-work-an">AngularJS - Why when changing url address $routeProvider doesn&#39;t seem to work and I get a 404 error</a></p>
  
  <p>The accepted answer says to setup Apache to reconfigure all paths to the root. My site is on Github Pages. I have a <code>.htaccess</code> file in my <code>gh-pages</code> repo but I have no idea how to configure it to send all paths to the root.</p>
  
  <p>The answer says another thing to consider is using the <code>&lt;base&gt;</code> element like <code>&lt;base href="/" /&gt;</code> but where would I place that? In my <code>index.html</code>? If so at the top or bottom of that file? Also, would I just leave the <code>href</code> value to <code>/</code>?</p>