title: Rewrite URLs for static content
body: <p>I have problems with static files url rewriting in current .htaccess setup on apache2.</p>
  
  <p>My app structure is:</p>
  
  <pre><code>/siteroot
  /siteroot/app
  /siteroot/lib
  /siteroot/...
  /siteroot/public &lt;- all the static files (images, js, etc.) stored here
  /siteroot/index.php
  /siteroot/.htaccess
  </code></pre>
  
  <p>So, i need to rewrite url like /css/style.css to /public/css/style.css. I did that in really simple way, but when the file is not found it causing 10 internal redirects, which is bad. I need somehow to return 404 code if file not found, or just pass it to the next rule. And i dont have any access to site configuration file. Only .htaccess.</p>
  
  <p>The reason why i`m asking this question is that the site was running on nginx and i need to rebuild the same configuration on apache.</p>
  
  <p>Here is my .htaccess file.</p>
  
  <pre><code>RewriteEngine On
  RewriteBase /
  
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^.+\.(jpg|jpeg|gif|png|ico|css|js|swf)$ /public/$0 [L]
  
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.php [L]
  </code></pre>