title: .htaccess rewrite to index.php infinite loop
body: <p>I am building a clean url system using .htaccess and php.
  The main idea is to rewrite everything to index.php and to split the url to segments separated by /.
  It works but when I upload it to web server I get an infinite loop error. </p>
  
  <p>My .htaccess file is:</p>
  
  <pre><code>RewriteEngine on
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule . index.php [L]
  </code></pre>
  
  <p>If I get things correctly - the problem is that it redirects index.php to itself but it shouldn't because I have index.php file that handles everything and <code>RewriteCond %{REQUEST_FILENAME} !-f</code> which should prevent that rewrite.</p>
  
  <p>Could you please help me with this .htaccess - I want it to rewrite everything to index.php and to be as portable as it can be, so I can use it in:</p>
  
  <p>www.mysite.com
  www.myothersite.com</p>
  
  <p>or even
  www.mysite.com/new/</p>
  
  <p>I also want to redirect something like www.mysite.com/articles/2 to index.php as well as www.mysite.com/articles/it/2 or even www.mysite.com/articles/it/search/searchterm</p>