title: IIS Url rewrite rule for Angular SPA + WebApi
body: <p>I have a SPA + WebAPI application, they are both in the same project. I only want the WebAPI application to process requests from the directory "api". So anything under api will be handled by the server, everything else will be handled by the Angular SPA.</p>
  
  <p>I currently have</p>
  
  <pre><code>   &lt;rewrite&gt;
        &lt;rules&gt;
          &lt;rule name="AngularJS" stopProcessing="true"&gt;
            &lt;match url=".*" /&gt;
            &lt;conditions logicalGrouping="MatchAll"&gt;
              &lt;add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /&gt;
              &lt;add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /&gt;
              &lt;add input="{REQUEST_URI}" pattern="^/(api)" negate="true" /&gt;
            &lt;/conditions&gt;
            &lt;action type="Rewrite" url="/" /&gt;
          &lt;/rule&gt;
        &lt;/rules&gt;
      &lt;/rewrite&gt;
  </code></pre>
  
  <p>This works OK except when I go to the URL </p>
  
  <p><code>http://localhost/customers/2</code> (which loads the doc but all resources are coming in with the wrong mime type I have concluded its because of the redirect rules above)</p>
  
  <p>the URL <code>http://localhost/customers</code> works fine will be routed by my SPA app</p>
  
  <p>How do I get everything to be redirected to my SPA except for the requests that come under the API directory?</p>