title: CSS / JS / Images not loading from a different directory than main webroot in CakePHP
body: <p>I have been working on a CakePHP App, most of the CSS / JS / images (icons) are located in the webroot directory (/var/www/app/webroot/), but for some portion (Croogo) or other pages of the app, I need to load CSS / JS / images from a different directory i.e /var/www/app/views/themed/admin/webroot/.</p>
  
  <p>Now the issue I am facing is that when I render these other pages the css / JS / images requests return 404 page not found status, as these requests are made to main webroot rather than the different directory i mentioned above. </p>
  
  <p>Is there a way to handle this with .htaccess, i.e
  if the url contains this pattern "/admin/" </p>
  
  <p>Example:</p>
  
  <blockquote>
    <p><a href="http://www.myapp.com/theme/admin/css/mycss.css" rel="nofollow">http://www.myapp.com/theme/admin/css/mycss.css</a></p>
  </blockquote>
  
  <p>The CSS / JS / img files should be looked up into /var/www/app/views/themed/admin/webroot/ rather than var/www/app/webroot/ ??</p>
  
  <p>If not is there any other workaround to handle such a scenario? </p>
  
  <p>Following is the .htaccess of main app directory</p>
  
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
      RewriteEngine on
      RewriteRule    ^$    webroot/    [L]
      RewriteRule    (.*) webroot/$1    [L]     
  &lt;/IfModule&gt;
  </code></pre>
  
  <p>Following is the .htaccess of main webroot directory</p>
  
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
      RewriteEngine On
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
  &lt;/IfModule&gt;
  </code></pre>
  
  <p>CakePHP code</p>
  
  <pre><code>echo $html-&gt;link($html- &gt;image('../theme/admin/img/icons/16/icon16x16.png',array('alt'=&gt;'','class'=&gt;'icon left','id'=&gt;'profile-icon')).'Resize',array('action'=&gt;'edit_photo','01'),array('escape'=&gt;false,'id'=&gt;'profile-photo','class'=&gt;'blue','rel'=&gt;'shadowbox;height=100;width=400','title'=&gt;'Resize'));
  </code></pre>
  
  <p>Generated HTML</p>
  
  <pre><code>&lt;a href="/edit_photo/01" id="profile-photo" class="blue" rel="shadowbox;height=100;width=400" title="Resize"&gt;&lt;img src="/theme/admin/img/icons/16/icon16x16.png?v=1000" alt="" class="icon left" id="profile-icon" /&gt;Resize&lt;/a&gt;&lt;/div&gt;
  </code></pre>
  
  <p>CakePHP version 1.3  </p>
  
  <p>Any thoughts and ideas would be appreciated!</p>