tags:

views:

38

answers:

2

I have a site that works off several TLDs. I want to save the initial referrer, from where the user came from, before they are redirected to the correct domain. After the redirect, the referrer is obviously rewritten (and it wont read cookies or sessions set on another domain).

is there a way I could pass it in a GET variable when redirecting, and then overwrite it once the user lands on the domain, so it could be saved if they register to the site.

I use php.

+2  A: 
<?php
// on the first domain
header("Location: http://newdomain.com/?referrer=".urlencode($_SERVER['HTTP_REFERRER']));
die();

Then on the correct domain you can just get the referrer using $_GET['referrer'].

webdestroya
+1  A: 

If you use a HTTP 301 redirect then most(?) browsers will send the original referrer information to the new destination.

Sparr