title: Nginx rewrite rules for AngularJS and html5mode enabled
body: <p>so far,i am building AngularJS application served with nginx. I had rails in the middle and i came with <code>rewrite ^/(?!assets) / last;</code>  rewrite rule (rewrite everything expect those beginning with assets), so far it was working - with rails:</p>
  
  <pre><code>   server {
        listen 80;
        server_name ies.local;
        root /home/jk/Projects/ies12/webapp/public;   # &lt;--- be sure to point to 'public'!
        passenger_enabled on;
        rails_env development;
        rewrite ^/(?!assets) / last;
      }
  </code></pre>
  
  <p>But by today, i left rails and i need to extend this rule..</p>
  
  <p>If I do something like</p>
  
  <pre><code>server {
    listen 80;
    server_name webapp.local;
    root /home/jk/Projects/webapp;
    rewrite_log on;
  
    rewrite ^/(?!angular) / last;
    rewrite ^/(?!angular-ui) / last;
  }
  </code></pre>
  
  <p>having webapp/index.html only file
  and getting:</p>
  
  <pre><code>*1 rewrite or internal redirection cycle while internally redirecting to 
  "/index.html", client: 127.0.0.1, server: webapp.local, request: "GET / HTTP/1.1", host: "webapp.local"
  </code></pre>