title: Keep query string for external urls
body: <p>A user can be sent to the main website by some referral id, using a query string:</p>
  
  <pre><code>www.site.com/?ref=XXX
  </code></pre>
  
  <p>And when they click on a link to a login area, this query string must go with that external link:</p>
  
  <pre><code>https://internal.site.com?ref=XXX
  </code></pre>
  
  <p>I am working with wordpress, so I cannot append <code>?ref=&lt;?php echo $_GET['ref']?&gt;</code> to that link.</p>
  
  <p>I have already changed <code>.htaccess</code> to:</p>
  
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
  RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.php - [L,QSA]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.php [L,QSA]
  &lt;/IfModule&gt;
  </code></pre>
  
  <p>Every link back to the main website keeps the query strings, but external urls do not.</p>
  
  <pre><code>www.site.com?ref=XXX [original]
  www.site.com/go/reds?ref=XXX [query strings are kept]
  https://internal.site.com [query strings are removed]
  </code></pre>
  
  <p>The <code>QSA</code> flag in <code>htaccess</code> should do the trick, but it's not working for external links.</p>