title: mod-rewrite infinite recursion
body: <p>I have the following problem with apaches mod-rewrite (it's probably a simple one, but I'm just not getting it ...)</p>
  
  <p>I want my URL paths to start with a two-letter part (country code), like</p>
  
  <pre><code>http://www.example.com/se/
  </code></pre>
  
  <p>Whenever an URL doesn't match this pattern, I want my <code>.htaccess</code> to do a redirect to a fixed starting address like the above <code>http://www.example.com/se/</code>. </p>
  
  <p>I also need to redirect URLs that do not end in a trailing slash (i.e. <code>http://www.example.com/se</code> should also be redirected ...)</p>
  
  <p>I've put the following lines in my <code>.htaccess</code>:</p>
  
  <pre><code>RewriteEngine On
  RewriteBase /
  RewriteCond %{QUERY_STRING} !^/[a-z]{2}/
  RewriteRule ^(.*)$ se/ [R,L]
  </code></pre>
  
  <p>But this results in an infinite recursion since a request <code>http://www.example.com/se/</code> is also redirected. I do not get, why the <code>RewriteCond</code> becomes true in this case.</p>