title: htaccess 301 redirection using regular expression
body: <p>This is my current .htaccess file</p>
  
  <pre><code>RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_URI} !(.*)/$
  RewriteRule ^(.*)$ $1/
  
  
  RewriteRule ^([^/]+)/$ index.php?p1=$1 [L]
  RewriteRule ^([^/]+)/([^/]+)/$ index.php?p1=$1&amp;p2=$2 [L]
  RewriteRule ^([^/]+)/([^/]+)/([^/]+)/$ index.php?p1=$1&amp;p2=$2&amp;p3=$3 [L]
  RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/$ index.php?p1=$1&amp;p2=$2&amp;p3=$3&amp;p4=$4 [L]
  RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/$ index.php?p1=$1&amp;p2=$2&amp;p3=$3&amp;p4=$4&amp;p5=$5 [L]
  </code></pre>
  
  <p>Basically, it takes up to five "Friendly url folders" and assign the value to varibles and then, send those to my index.php page</p>
  
  <pre><code>IE: http://www.example.com/ford/focus/grey/
  
  $p1 = 'ford';
  $p2 = 'focus';
  $p3 = 'grey';
  $p3 = 'grey';
  </code></pre>
  
  <p>So far, so good.</p>
  
  <p>Now, I need to integrate a 301 instruction (RegExp?) in that same .htaccess because initially, I had GET parameters like this :</p>
  
  <pre><code>IE: http://www.example.com/ford/focus/grey/?lang=fr
  </code></pre>
  
  <p>I need to get rid of all GET variables because Google sees it as duplicate content (even if I'm using the nofollow attribute on my languages links)</p>
  
  <pre><code>IE: http://i.want.to.keep/my/url/?AND_DUMP_GET_VARIABLES
  
  http://www.example.com/ford/focus/grey/?lang=fr
  http://www.example.com/ford/focus/grey/?lang=en
  http://www.example.com/ford/focus/grey/?lang=sp
  ==&gt; http://www.example.com/ford/focus/grey/
  </code></pre>
  
  <p>Logically, the instruction should be interpreted between the first and the second block but I just don't know where to start. Any hints?</p>
  
  <p>THANKS!</p>