title: Nginx: how to let rewrite rules ignore files or folders
body: <p>I use Nginx to serve a SPA (Single Page Application), in order to support HTML5 History API I have to rewrite all deeper routes back to the <code>/index.html</code>, so I follow <a href="http://readystate4.com/2012/05/17/nginx-and-apache-rewrite-to-support-html5-pushstate/" rel="noreferrer">this article</a> and it works! This is what I put in nginx.conf now:</p>
  
  
  
  <pre><code>server {
      listen 80 default;
      server_name my.domain.com;
      root /path/to/app/root;
  
      rewrite ^(.+)$ /index.html last;
  }
  </code></pre>
  
  <p>However there's one problem, I have an <code>/assets</code> directory under the root contains all the css, js, images, fonts stuffs, I don't want to rewrite these urls, I just want to ignore these assets, how am I suppose to do?</p>