title: Writing a rule in .htaccess to match the correct images folder location
body: <p>In my single-page-webapp i used the html5 history API so that urls could have a REST pattern (/section1/stuff1..) and i'm planning to make a sort of a javascript router to navigate to several sections of the page depending on the url path.</p>
  
  <p>Right now i'm still working on a local server(wamp) and i added a .htaccess file: </p>
  
  <pre><code>RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule (.*) index.php/$1 [L]
  </code></pre>
  
  <p>to the app root for that url's paths containing references to some sections of the page (e.g subdomain/sectionN) can redirect always to the index.php and the redirection was successful <strong>BUT</strong>   all external ressources failed to load and i got :</p>
  
  <pre><code>Resource interpreted as Image but transferred with MIME type text/html: "http://localhost/subdomain/section1/images/imgname.gif".
  </code></pre>
  
  <p>and it's logic because the images folder lies in the app root and not under a <code>/section1</code> folder and the .htaccess rule <code>RewriteRule (.*) index.php/$1 [L]</code> should take only the <code>/images/imgname.gif</code> part and concatinate it after the <code>http://localhost/subdomain/</code>.</p>
  
  <p>I found <a href="http://wenda.soso.io/questions/2919226/rewrite-engine-htaccess-mime-type-error" rel="nofollow">this</a> as a similar problem so i rewrite the .htaccess file like this :</p>
  
  <pre><code>RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^/?section1/(.+)$ index.php/$1 
  RewriteRule (.*) index.php/$1 [L]
  </code></pre>
  
  <p>but i got a <code>500 Internal Server Error</code>.</p>