title: RewriteRule to remove %2f in query string
body: <p>i have a bunch of miss-generated URLs, which i would like to redirected to the correct URL.</p>
  
  <p>This is a good example:</p>
  
  <pre><code>http://example.com/search/?q=searchterm%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F&amp;scope=45%2F%2F%2F%2F%2F/
  </code></pre>
  
  <p>I already could redirect most of them with the following rule:</p>
  
  <pre>
  
      RewriteCond %{QUERY_STRING} ^(.*)%2F
      RewriteRule ^search/$ /search/?%1 [NE,R=301,L]
  
  </pre>
  
  <p>As i understand, this only works because the trailing "%2F" is removed and then the rule hits again. Google only accepts a limited number of redirects.</p>
  
  <p>So i try to adapt the rule to work with 1 or more occurrences of "%2f"</p>
  
  <p>This is how far i got:</p>
  
  <pre>
  
      RewriteCond %{QUERY_STRING} ^(.*)((%2F)*)
      RewriteRule ^search/$ /search/?%1 [NE,R=301,L]
  
  </pre>
  
  <p>The results are:
  /search/?q=searchtermFFFFFFFFFFFFFFFF&amp;scope=45FFFFF/ </p>
  
  <p>What am i missing?</p>
  
  <p>Best regards,
  Alexander</p>