0

I am facing a small issue and can´t find the right answer. Searched here for 2.5 hours now and couldn´t find the solution.

I guess it´s because my question is more basic (found very complex and interesting solutions).

Here is the issue:

User comes through my tracking software to my website. The tracking software passes the user with a unique ID in the URL.

The URL looks like this in such a case:

www.myexample.com/product1?clickid=buzwqg98rz3vd7 (clickid value will be different for every visitor).

what I want to do now is redirect the visitor to another URL.

Lets say the other URL is www.otherurl.com/good1

Problem is that the user should be redirected together with the unique clickid value.

Short:

From: www.myexample.com/product1?clickid=buzwqg98rz3vd7 To: www.otherurl.com/good1?clickid=buzwqg98rz3vd7

So that the unique value will land in the URL I am redirecting to. I hope I described it properly.

It would be great if someone could help me here as I am at the end of my (I admit it) poor knowledge.

Thanks to all of you,

Aron

3
  • I tried to edit but it seems there is a bug. Forgot to say hello to all of you, please don´t be mad - I´ll say hello to you now: Hello all :)
    – Aron
    Aug 27, 2015 at 17:01
  • Why does a simple Redirect a b directive not do what you want it to do?
    – Sumurai8
    Aug 27, 2015 at 17:03
  • Doesn't this cover your question? Aug 27, 2015 at 17:03

4 Answers 4

0

on product1 page, do below things before any output. (set them to beginning of the page)

$clickId      = $_GET["clickid"];
$redirectLink = "http://www.otherurl.com/good1?clickid=$clickId";
header("location:".$redirectLink);
0

You can use in your .htaccess:

RewriteEngine on 
RewriteRule ^product1$ http://www.otherurl.com/good1 [L,R=301,QSA]
0

A simple Redirect directive in your .htaccess file should do the trick. This directive does not manipulate the query string, but simply copies it over to the new url:

Redirect /product1 /good1
0

at first I'd like to thank all of you for your interest and your answers! Awesome community here!

I actually found an easy way to get what I need, but still thought I should update here for anyone who might be looking for this information.

I created a php file and am linking now to that php file to successfully redirect the visit with it's query string.

<?php
header("Status: 301 Moved Permanently");
header("Location: http://www.otherurl.com/good1?". $_SERVER['QUERY_STRING']);
exit;
?>

Thanks again for all your answers, you are awesome guys!

Your Answer

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

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