title: mod_rewrite in subdirectory to subdirectory
body: <p>I'm having trouble getting my mod_rewrite to work. In a frustrating fashion it works in my dev mode and at <a href="http://htaccess.madewithlove.be/" rel="nofollow">http://htaccess.madewithlove.be/</a> it works just fine.</p>
  
  <p>I have made sure mod_rewrite is enabled on my server.</p>
  
  <p>What I am trying to do is have the following URL</p>
  
  <pre><code>a. http://www.site.net/chat/
  b. http://www.site.net/chat/groups.php?test
  </code></pre>
  
  <p>Invisibly redirect to</p>
  
  <pre><code>a. http://www.site.net/chat/www/page_loader.php/
  b. http://www.site.net/chat/www/page_loader.php/groups.php?test
  </code></pre>
  
  <p>The www subdirectory contains all the files for chat. The .htaccess is contained within the chat subfolder though having a quick test whiles typing this question, it seems to behave differently when I place it in the root directory (though not work there either). The .htacess file looks like:</p>
  
  <pre><code>RewriteEngine On
  RewriteBase /
  
  #place everything in the www directory
  RewriteCond %{REQUEST_URI} !^.*/chat/www/.*$
  RewriteRule ^.*chat/(.*)$ chat/www/$1
  
  #send everything through the page loader
  RewriteCond %{REQUEST_URI} !\.(gif|jpg|png|swf|css|html|js|ico|pdf)$
  RewriteCond %{REQUEST_URI} !^/chat/www/page_loader.php$
  RewriteCond %{REQUEST_URI} !^/chat/www/page_loader.php/
  RewriteRule ^.*chat/www/(.*)$ chat/www/page_loader.php/$1?%{QUERY_STRING} [L]
  </code></pre>
  
  <p>When I run the code on the htaccess tester (link above) using the following URL</p>
  
  <pre><code>http://www.site.net/chat/groups.php?test
  </code></pre>
  
  <p>The result is exactly as I want it to be:</p>
  
  <pre><code>http://www.site.net/chat/www/page_loader.php/groups.php?test
  </code></pre>
  
  <p>The page loader is just a script which I automatically run to include common definitions etc. before loading the required script. It is a system I brought over from another site I work on.</p>
  
  <p>Even if I take everything to do with the pageloader out the first section does not even append the /www/ as required.</p>
  
  <p>I am at a loss here. How can I get the desired result? Thank you.</p>