title: htaccess redirect to subdomain based on query string
body: <p>I searched for similar questions but none of them was applicable to my situation.</p>
  
  <p>What I need to do is redirect from old url's that have specific query string: <code>option=com_virtuemart</code> to a subdomain : <code>http://parts.domain.com</code></p>
  
  <p>Tried bunch of rules and conds but haven't achieved right redirection. It was always redirecting me to <code>http://parts.domain.com/index.php?option=com_virtuemart</code></p>
  
  <p>Some of the rules I tried:</p>
  
  <pre><code>RewriteCond %{QUERY_STRING} (^|&amp;)option=com_virtuemart(&amp;|$) [NC]
  RewriteRule (.*) http://parts.domain.com/$1 [R=301,L]
  
  RewriteCond %{QUERY_STRING} (^|&amp;)option=com_virtuemart(&amp;|$) [NC]
  RewriteRule http://parts.domain.com/? [L,NC,R=301]
  </code></pre>
  
  <p>And like 50 other rules. What mistakes I'm doing here?</p>