title: Nginx path folder rewrite
body: <p>Simple path rewrite in Nginx, I can't get it to work.</p>
  
  <p>from this:</p>
  
  <pre><code>/assets/sites/fpi/css/reset.css
  </code></pre>
  
  <p>to this:</p>
  
  <pre><code>/assets/sites/default/css/reset.css
  </code></pre>
  
  <p>my rule looks like this:</p>
  
  <pre><code>rewrite ^/assets/sites(.+)$ /assets/sites/default/$1 last;
  </code></pre>
  
  <p>/** UPDATE **/</p>
  
  <p>Thanks for the helpful answers so far. I would like a more generic way to target the "fpi" section of the URL path.</p>
  
  <p>Something like:</p>
  
  <pre><code>&lt;pre&gt;
  rewrite ^(/assets/sites)/\w*/(.*)$ $1/default/$2 last;
  &lt;/pre&gt;
  </code></pre>
  
  <p>Which would match any part of that section so all urls matching this pattern:</p>
  
  <pre><code>&lt;pre&gt;
  /assets/sites/fpi/css/reset.css
  /assets/sites/gbc/css/reset.css
  /assets/sites/ekg/css/reset.css
  &lt;/pre&gt;
  </code></pre>
  
  <p>would shift to:</p>
  
  <pre><code>&lt;pre&gt;
  /assets/sites/default/css/reset.css
  /assets/sites/default/css/reset.css
  /assets/sites/default/css/reset.css
  &lt;/pre&gt;
  </code></pre>
  
  <p>Thanks</p>