title: Mod rewrite redirection to another domain if file not exist
body: <h3>What I'm trying to do:</h3>
  
  <p>I need to redirect a request to a file to another domain if the file not exists. For example:</p>
  
  <pre><code>http://www.mydomain.com/js/foo.js 
  </code></pre>
  
  <p>redirects to (if not exists)</p>
  
  <pre><code>http://www.myanotherdomain.com/js/foo.js
  </code></pre>
  
  <h3>What I do:</h3>
  
  <p>I wrote the next lines at the end the htaccess, but they redirect ALL!</p>
  
  <pre><code>RewriteCond %{REQUEST_URI} !-f
  RewriteRule ^(.*)$ http://www.myanotherdomain.com/$1 [L,NC]  
  </code></pre>
  
  <p>Before these lines, I have a lot of lines like this (I'm using MVC (Model, View,Controller)):</p>
  
  <pre><code>RewriteRule ^car/brand/?$ ?controller=Car&amp;action=viewBrand [L,NC]  
  </code></pre>
  
  <h3>What happens:</h3>
  
  <p>It works wells with non existing files, but seems to be imcompatible with the MVC rules. These rules have to match and then stop evaluating rules because de "L" flag. But it seems to continue evaluation of the rules and finally evaluates the redirect rule. The result is this:</p>
  
  <pre><code>http://www.mydomain.com/car/brand/
  </code></pre>
  
  <p>goes to</p>
  
  <pre><code>http://www.myanotherdomain.com/?controller=Car&amp;action=viewBrand
  </code></pre>
  
  <p><em>Please can anyone help me?</em></p>
  
  <p><em>Thank you very much,</em></p>
  
  <p><em>Jonathan</em></p>