title: how to redirect request based wether a query string value is present?
body: <p>I've searched and tried many examples but none seem to work for me. I need to redirect a request to a specific url depending on if the original request had a certain item in it's query string.</p>
  
  <p>e.g.</p>
  
  <p>www.mydomain.com/test.html?username=foo&amp;password=bar</p>
  
  <p>So I want to redirect this only is the username variable is present in the query string to</p>
  
  <p>www.mydomain.com/home.html?username=foo&amp;password=bar</p>
  
  <p>But also, the page could be any page, .e.g test.html, home.html, contact.php</p>
  
  <p>So if username variable is detected in query string, then the redirect will happen only.</p>
  
  <p>thanks for your help.</p>
  
  <p>I tried this but it did not work:</p>
  
  <p><code>RewriteRule ^username(.*)$ test.html?username=$1 [L,QSA]</code></p>