title: language parameter rewrite with mod_rewrite
body: <p>I need some help with mod_rewrite doing multiple things to the url procedurally:</p>
  
  <ul>
  <li><p>If the url starts with en,es,pt-br, remove it and add ?lang=$1</p></li>
  <li><p>If the url does not next have 'web/' in it, add it.</p></li>
  <li><p>If the url is blank, go to 'web/en/'</p></li>
  <li><p>None of them should actually rewrite the url</p></li>
  </ul>
  
  <p>This means:</p>
  
  <pre><code> http://www.domain.com/en  &gt;&gt; http://www.domain.com/web/?lang=en
   http://www.domain.com/en/mobile  &gt;&gt; http://www.domain.com/mobile/?lang=en
  </code></pre>