title: Mod_Rewrite variable dynamic directory inside of two static ones
body: <p>So I am trying to force javascript files to reload whenever we as developers update the files. In order to do this we are using the answer found here <a href="https://stackoverflow.com/a/7671705/805779">https://stackoverflow.com/a/7671705/805779</a> and we think this will work great however I am not sure how to do the mod rewrite. So here is the link I have</p>
  
  <pre><code>www.mysite.com/js/v1/myjs.js
  </code></pre>
  
  <p>I need to change it to</p>
  
  <pre><code>www.nysite.com/js/myjs.js
  </code></pre>
  
  <p>This is what I have so far but it is not working </p>
  
  <pre><code>&lt;IfModule mod_rewrite&gt;
      RewriteEngine On
      RewriteBase /
      RewriteRule ^/js/(.*)$/(.*)$ js/$2 [L,NC,R]
  &lt;/IfModule&gt;
  </code></pre>
  
  <p>After some more testing I found my main issue was not adding .c to my IfModule, with that in mind the following is "partially" working</p>
  
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
      RewriteEngine On
      RewriteRule ^/css/(.*)/(.*)$ /css/$2 [L,NC,R]
      RewriteRule ^/js/(.*)/(.*)$ /js/$2 [L,NC,R]
  &lt;/IfModule&gt;
  </code></pre>
  
  <p>This works for my classic example </p>
  
  <pre><code>www.mysite.com/js/v1/myjs.js =&gt; www.nysite.com/js/myjs.js
  </code></pre>
  
  <p>However this does not work if more then one variable are involved. aka </p>
  
  <pre><code>www.mysite.com/js/v1/min/pages/myjs.js 
  </code></pre>
  
  <p>My version number v1 will always be directly after the root folder so js/v1 or css/v1 and I want to remove the v1 and keep everything after it</p>