title: .htaccess rewrite with HTTP_HOST and QUERY_STRING
body: <p>I would like to set up a redirect to a new host with query string. I am struggling to get the query added to the end of the target url. Here is my example old url</p>
  
  <p><code>http://sub.oldexample.com/folder1/page1?value=ABC123</code></p>
  
  <p>I would like it to go to</p>
  
  <p><code>http://newexample.com/folder3/page6?value=ABC123</code></p>
  
  <p>I do not have a problem when a <code>query</code> is not involved, for example the following code works perfectly but is unsuitable </p>
  
  <pre><code>RewriteCond %{HTTP_HOST} ^sub.oldexample.com$ 
  RewriteRule ^folder1/([A-Za-z][A-Za-z][A-Za-z][0-9][0-9][0-9])$ http://newexample.com/folder3/$1 [L,R=301,NC]
  </code></pre>
  
  <p>I have tried to include a <code>query</code> condition but it fails</p>
  
  <pre><code>RewriteCond %{HTTP_HOST} ^sub.oldexample.com$ [NC]
  RewriteCond %{QUERY_STRING} ^(value=ABC123)
  RewriteRule ^$ http://newexample.com/folder3/page6?%1 [L,R=301,NC]
  </code></pre>
  
  <p>I find the following link a perfect environment for testing a <code>.htaccess</code> rule as it gives the output url that is generated</p>
  
  <p><a href="http://htaccess.madewithlove.be/" rel="nofollow">http://htaccess.madewithlove.be/</a></p>