1

For my affiliate links I want them to be redirect through an intermediate page (calling it routers) to measure certain datas and efficiency.

Assuming I have my affiliate link as www.affiliate.in?id=sdff&para=dshjgsf&aaffid=JAHAJEE and an intermediate page www.mysite.com/redirect.php?someid=1&otherid=2&url=THE_URL_TO_REDIRECT_TO

My problem is that affiliate links have ? and & and so when I use my affiliate link in this router URL, I am unable to get complete $_GET[url] ! Any help on how to do it with these additional parameters intact ?

3
  • With {QUERY_STRING} for htaccess. Read document wiki.apache.org/httpd/RewriteQueryString Commented Jun 30, 2014 at 9:33
  • 1
    urlencode / rawurlencode Commented Jun 30, 2014 at 9:34
  • @jahajee.com Show your htaccess code Commented Jun 30, 2014 at 9:54

3 Answers 3

1

Encode the Url

string urlencode ( string $str )

This function is convenient when encoding a string to be used in a query part of a URL, as a convenient way to pass variables to the next page.

pass the THE_URL_TO_REDIRECT_TO to the function

as

 urlencode(THE_URL_TO_REDIRECT_TO )

php.net

Sign up to request clarification or add additional context in comments.

Comments

1

Encode your url and use it (urlencode)

<?php 
$afurl = urlencode('http://www.affiliate.in?id=sdff&para=dshjgsf&aaffid=JAHAJEE');
$url = 'http://www.yourdomain.com/redirect.php?someid=1&otherid=2&url='.$afurl;
echo $url;
?>

this urlencode encrypt all of your special characters.

if you want to get url using htacces use the following link. This will guide you lot.

htaccess url as parameter

The major issue i think you get the URL in this format [a-zA-Z0-9|] you need to change it to (.*)

Comments

0

you can get the values passed in the url by

$_SERVER['QUERY_STRING']

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.