Reputation: 10398
I'm trying to forward all traffic for countly analytics
from a subdomain to an Amazon EC2 domain, keeping all parameters intact just as they where sent.
I am using this in my .htaccess file:
RewriteEngine on
RewriteRule ^i(\?.+)$ http://ec2-11-111-11-11.us-west-2.compute.amazonaws.com/i?$1 [R,L,QSA]
RewriteRule ^(.*)$ http://ec2-11-111-11-11.us-west-2.compute.amazonaws.com/$1 [R,L]
This partially works, as entering my subdomain into Safari forwards to the countly web interface, and also user sessions from my app are being recorded by countly on the AWS. However the parameters that also get sent like App Version, Screen Resolution, etc.. are not forwarded as they are just missing from the stats.
Can anyone shed any light on this?
Thanks
Upvotes: 1
Views: 87
Reputation: 784928
You cannot match QUERY_STRING
using RewriteRule
so this rule isn't really workung for you:
RewriteRule ^i(\?.+)$ http://ec2-11-111-11-11.us-west-2.compute.amazonaws.com/i?$1 [R,L,QSA]
Try this code instead:
RewriteRule ^i/?$ http://ec2-11-111-11-11.us-west-2.compute.amazonaws.com%{REQUEST_URI} [R,L,NE,NC]
QUERY_STRING
is automatically carried over to the redirected URL. unless ?
is used as last character in the end to strip off any existing query string.
Upvotes: 1