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

Aron
  • 1

4 Answers4

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);
hakki
  • 6,181
  • 6
  • 62
  • 106
0

You can use in your .htaccess:

RewriteEngine on 
RewriteRule ^product1$ http://www.otherurl.com/good1 [L,R=301,QSA]
Croises
  • 18,570
  • 4
  • 30
  • 47
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
Sumurai8
  • 20,333
  • 11
  • 66
  • 100
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!

Aron
  • 1