title: htaccess is rewriting entire URL and leaving off subdirectories
body: <p>I thought I had this figured out but no dice... I'm attempting to rewrite a domain but preserve the subdirectory paths:</p>
  
  <p><em><strong>www.olddomain.com/sub/directory/page.php</em></strong></p>
  
  <p>TO</p>
  
  <p><em><strong>www.newdomain.com/sub/directory/page.php</em></strong></p>
  
  <p>The following two directives are both needed. The first is the attempt to accomplish the above. The second is inserting a hidden "index.php" before every URL.</p>
  
  <pre><code>RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com$
  RewriteRule ^(.*)$ http://www.newdomain.com/$1 [R=301,L]
  
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^ index.php [L]
  </code></pre>
  
  <p>Curently, no matter what URL I visit on olddomain.com, it takes me to newdomain.com/index.php. Maybe it is inserting the "index.php" from the previous site... I inserted [L] to attempt it to stop parsing the .htaccess file but it doesn't like that either. Any direction would be much appreciated.</p>