Keep query string for external urls

admin

Administrator
Staff member
A user can be sent to the main website by some referral id, using a query string:

Code:
www.site.com/?ref=XXX

And when they click on a link to a login area, this query string must go with that external link:

Code:
https://internal.site.com?ref=XXX

I am working with wordpress, so I cannot append
Code:
?ref=<?php echo $_GET['ref']?>
to that link.

I have already changed
Code:
.htaccess
to:

Code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php - [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L,QSA]
</IfModule>

Every link back to the main website keeps the query strings, but external urls do not.

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]

The
Code:
QSA
flag in
Code:
htaccess
should do the trick, but it's not working for external links.