title: HOWTO: rewrite requests for images, css and js to different folders for each application?
body: <p>I am trying to build a multi-app CodeIgniter site, where the assets for all apps will be stored in a single folder called “assets.” Inside this single folder, each app would have its own asset folder. So, if this is my root directory…</p>
  
  <pre>
   user_guide
   apps_folder (this is where all my application folders live)
   system
   assets
  
  </pre>
  
  <p>...the assets folder will be organized thus:</p>
  
  <pre>
  assets
    myapp1
        js
        img
        css
        media
  
  </pre>
  
  <p>Here is my challenge. I am trying to write an apache directive that would rewrite all requests for files ending in css, js, png and gif to the respective asset directory for that app. But the user cannot know the exact location of those assets in the server. To give you an example:</p>
  
  <p>Here is the request: www.myapp1.com/js/jquery.js</p>
  
  <p>The file is located in: assets/myapp1/js</p>
  
  <p>The directive will check for
  a) the domain address
  b) file extension</p>
  
  <p>...and based on those variables, will rewrite the url, thereby hiding thee real location of the asset, and make it possible to reference assets as if they were all located at the root of the website. Has anyone ever done something like this?</p>
  
  <p>thanks,</p>