Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have two addresses for two servers:

www.urlA.com

www.urlB.com

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

<?php
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

1 Answer 1

up vote 1 down vote accepted

Try using a 301 redirect:

<?php
header('Location: http://www.urlB.com/', true, 301);
?>
share|improve this answer
    
This works charm!!! –  FEQ Feb 26 '11 at 19:10
1  
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

 
discard

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.