title: .htaccess - rewriting url requests and taking care of resource files
body: <p>I thought i should open a new question for a matter related to my previous one (you can find it <a href="https://stackoverflow.com/questions/22494033/htaccess-rewriting-url-requests-and-taking-care-of-css-files">here</a>). The situation is very similar to that question, but i found a different approach, and would like to know if it's correct.</p>
  
  <p>I wanted to rewrite the urls for my site, and being able to take care of resource files (css, js, images, etc) so that browser doenn't search for them in the wrong directory. </p>
  
  <p>Following are snippets of the html code of a sample page found browsing for example to <code>articles/writer/erenor</code> (here htaccess rewrites the url to <code>/articles.php?writer=erenor</code>, and this part works well).</p>
  
  <p>Into <code>&lt;head&gt;</code> tag: </p>
  
  <pre><code>&lt;script type="text/javascript" src="./inc-javascript-files/jquery.js"&gt;&lt;/script&gt;
  
  &lt;style type="text/css"&gt;
    @import url(./inc-css-files/index.css);
  &lt;/style&gt;
  </code></pre>
  
  <p>Into <code>&lt;body&gt;</code> tag:</p>
  
  <pre><code>&lt;img alt="Avatar" src="./inc-images-files/avatar.png"&gt;
  &lt;img alt="Pattern" src="./inc-images-files/pattern/violet.png"&gt;
  &lt;br&gt;&lt;br&gt;
  &lt;a href="/articles/writer/erenor"&gt;Writer Erenor&lt;/a&gt;
  </code></pre>
  
  <p>Now, i have this snippet from .htaccess file:</p>
  
  <pre><code># take care of resource files
  RewriteRule inc\-(css|javascript|images)\-files/(.*)\.(png|jp[e]g|gif|js|css) includes-$1/$2.$3 [L]
  
  # url rewriting
  RewriteRule ^articles/writer/(\w*)/?$ articles.php?writer=$1
  </code></pre>
  
  <p>And, finally, the example of the file structure:</p>
  
  <pre><code>/mysite
  /mysite/.htaccess    //this is the htaccess file we are talking about ;-)
  /mysite/articles.php
  /mysite/includes-css
  /mysite/includes-css/index.css
  /mysite/includes-javascript
  /mysite/includes-javascript/jquery.js
  /mysite/includes-images
  /mysite/includes-images/avatar.png
  /mysite/includes-images/pattern
  /mysite/includes-images/pattern/violet.png
  </code></pre>
  
  <p>I just tested the code, and it seems to work: my browser asks for the css file (searching it in the "wrong" place) and it retrieves it correctly, so i'm quite happy with it :)
  Links in the page will be like the one in the html shown above, which seems to work well. </p>
  
  <p>Questions:
  1. Is this a good approach to be able to avoid browsers requests to resources being in the "wrong" place? (I know that i will have to add more parameters when it comes to other files like for example videos, txt's, tga, etc etc etc)
  2. Should i move this site to production server, will it work without modifications? In other words, is this a kind of "box" that can be moved here and there easily?</p>
  
  <p>A little note: since these are just code snippets, tell me if something appears to be missing..maybe i just forgot to copy/paste it ;-)</p>