I know how to pass a simple URL as a string variable through a URL (i.e. http://example.com/?site=http://amazon.com), however I have a bit more of a complicated situation which I cannot figure out.... what if the url I want to be passing contains variables of its own? i.e. http://amazon.com/?ref=00112233&size=med ?
Background: I have a Wordpress site where I have a box to input an affiliate link, which is attached to a button that a user would click. Rather than just putting in the affiliate link so that they are sent directly to the site, I instead want to pass the affiliate link to a php script which would alter the affiliate link based on their geographic location, and then redirect them to the altered location. For example, my affiliate link is: http://amazon.com/?ref=00112233&size=med ... I want to pass that to my script, and then say if the user was from Canada it would alter the link to be http://amazon.ca/?ref=998877&size=med (switches domain and referral #) and send them to that location.
When I input the following URL to attach to my button, http://example.com/?site=http://amazon.com/?ref=00112233&size=med the redirect doesn't work..FF comes up with a msg saying the redirect is setup in a way that will never complete. The redirect works fine if the site value is something simple like 'http://amazon.com'... so I'm assuming it's because the affiliate link itself contains a ? already.
Any thoughts on how to get around this? I can't find anything that addresses this circumstance.
Hopefully that wasn't too confusing--let me know if any clarification is needed.
Thank you!