title: Problem with htaccess URL rewrite rule, query string is being appended to resulting URL
body: <p>I have a set of rewrite rules that are supposed to process a URL that has anywhere from 1 to 5 parameters.  So my URL might look like this:
  www.site.com/topic1/page1 or www.site.com/topic1/sub1/page1.  </p>
  
  <p>Here are my rules in this example:</p>
  
  <pre><code>RewriteRule ^([^/.]+)/?$ /staticpages/process-selection.php?param1=$1 [E=rwdone:yes,L]
  RewriteRule ^([^/.]+)/([^/.]+)/?$ /staticpages/process-selection.php?param1=$1&amp;param2=$2 [E=rwdone:yes,L]
  RewriteRule ^([^/.]+)/([^/.]+)/([^/]+)/?$ /staticpages/process-selection.php?param1=$1&amp;param2=$2&amp;param3=$3 [E=rwdone:yes,L]
  RewriteRule ^([^/.]+)/([^/.]+)/([^/]+)/([^/]+)/?$ /staticpages/process-selection.php?param1=$1&amp;param2=$2&amp;param3=$3&amp;param4=$4 [E=rwdone:yes,L]
  RewriteRule ^([^/.]+)/([^/.]+)/([^/]+)/([^/]+)/([^/]+)/?$ /staticpages/process-selection.php?param1=$1&amp;param2=$2&amp;param3=$3&amp;param4=$4&amp;param5=$5 [E=rwdone:yes,L]
  </code></pre>
  
  <p>To complicate matters, I might have a redirect 301 from an old URL to one of these new URLs.  So "/topic1/page1/oldpage" might first get re-directed to "/topic1/page1/newpage".  </p>
  
  <p>For some reason, when the rewrite occurs, the URL that shows up in the browser has the correct URL, but with the old variables appended to the url like this:
  /topic1/page1/newpage?param1=page1&amp;param2=oldpage</p>
  
  <p>I'm wondering if there's any way to avoid this situation.  what the heck am I doing wrong here.</p>