0

I tried to create a referral url which looks something like, example.com/?ref=123456. So when some one clicks on that URL, it needs to redirect to the signup page, like [example.com/signup][2].

Also, needs to get the refer URL id, when signing up using this link.

I used Redirection plugin, which takes 2 options,

Source URL: /?ref=(*)

Target URL: /signup

But it is not working.

Any other way to redirect to signup page and capture the referal url?

0

At the top of your index page.

You could add.

if( isset( $_GET['ref'] ) && $_GET['ref'] !== '' )
    wp_safe_redirect( '/signup' )

Then, on the sign up page add:

$the_referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';

So you can do whatever you want with that, I would add some escaping etc and you'll prob have to str_replace() to get the ID solely.

Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.