title: nginx rewrite rules
body: <p>I'm trying to implement <code>nginx</code> rewrite rules for the following situtation :
  - Request <code>/testfa/styles/style.css</code> should be redirected to <code>/testfa/templates/styles/style.css</code>
  I've enabled rewrite logging for my server, created following rules:</p>
  
  <pre><code>location /testfa {     
    rewrite ^/styles/(.+)?$ /testfa/templates/styles/$1 last;
  }
  </code></pre>
  
  <p>but when I'm trying to perform request, I'm getting 404 error from server, and log file doesn't contain any info about rewriting, only following message:</p>
  
  <pre><code>open() "......../testfa/styles/style.css" failed (2: No such file or directory)
  </code></pre>
  
  <p>What is the correct way to perform such a rewrite for <code>nginx</code> ?</p>