Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have two addresses for two servers:



I have all my websites installed in www.urlB.com, but visitors recognize www.urlA.com primarily.

I have www.urlA.com/index.php as the following

header('Location: http://www.urlB.com/');

But, when I use this forwarding method, the tracking javascript in www.urlB.com cannot recognize where the visitors are from. I only obtain "NO REFERRING LINK"

What should I do to do the following two jobs: 1. to forward urlA.com to urlB.com 2. to receive the referrer information

share|improve this question
up vote 1 down vote accepted

Try using a 301 redirect:

header('Location: http://www.urlB.com/', true, 301);
share|improve this answer
This works charm!!! – Chang Feb 26 '11 at 19:10
Then select it as the correct answer! ;) – John Conde Feb 26 '11 at 19:24
Weird, that doesn't seem to make a difference on my test server. In either case, if the redirecting page is accessed via a link, referer data is passed, but if it's accessed directly, no referer data is passed. Whether I use 301 or the default 302 doesn't make a difference. – Lèse majesté Feb 27 '11 at 4:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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