title: How do I configure IIS for URL Rewriting an AngularJS application in HTML5 mode?
body: <p>I have the <a href="https://github.com/angular/angular-seed" rel="noreferrer">AngularJS seed project</a> and I've added </p>
  
  <pre><code>$locationProvider.html5Mode(true).hashPrefix('!');
  </code></pre>
  
  <p>to the app.js file. I want to configure IIS 7 to route all requests to     </p>
  
  <pre><code>http://localhost/app/index.html
  </code></pre>
  
  <p>so that this works for me. How do I do this?</p>
  
  <p><strong>Update:</strong></p>
  
  <p>I've just discovered, downloaded and installed the <a href="http://www.iis.net/downloads/microsoft/url-rewrite" rel="noreferrer">IIS URL Rewrite module</a>, hoping this will make it easy and obvious to achieve my goal.</p>
  
  <p><strong>Update 2</strong>:</p>
  
  <p>I guess this sums up what I'm trying to achieve (taken from the <a href="http://docs.angularjs.org/guide/dev_guide.services.$location" rel="noreferrer">AngularJS Developer documentation</a>):</p>
  
  <blockquote>
    <p>Using this mode requires URL rewriting on server side,
    basically you have to rewrite all your links to entry point of your
    application (e.g. index.html)</p>
  </blockquote>
  
  <p><strong>Update 3:</strong></p>
  
  <p>I'm still working on this and I realise I need to NOT redirect (have rules that rewrite) certain URLs such as </p>
  
  <pre><code>http://localhost/app/lib/angular/angular.js
  http://localhost/app/partials/partial1.html
  </code></pre>
  
  <p>so anything that is in the css, js, lib or partials directories isn't redirected. Everything else will need to be redirected to app/index.html</p>
  
  <p>Anyone know how to achieve this easily without having to add a rule for every single file?</p>
  
  <p><strong>Update 4:</strong></p>
  
  <p>I have 2 inbound rules defined in the IIS URL Rewrite module. The first rule is:</p>
  
  <p><img src="https://i.stack.imgur.com/3vFmW.png" alt="IIS URL Rewrite Inbound Rule 1"></p>
  
  <p>The second rule is:</p>
  
  <p><img src="https://i.stack.imgur.com/e9zKY.png" alt="IIS URL Rewrite Inbound Rule 2"></p>
  
  <p>Now when I navigate to localhost/app/view1 it loads the page, however the supporting files (the ones in the css, js, lib and partials directories) are also being rewritten to the app/index.html page - so everything is coming back as the index.html page no matter what URL is used. I guess this means my first rule, that is supposed to prevent these URLs from being processed by the second rule, isn't working.. any ideas? ...anyone? ...I feel so alone... :-(</p>