Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

As always, I would like to thank all of your help and assistance in advance.

I am looking for a way to automatically redirect a user to a site and maintain the redirect site as the referral site. Let me explain the process and what is needed in a step by step format.

  • User clicks on a desired link in an email
  • User is navigated to testdomain.com
  • User is automatically redirected to test.com/landing
  • test.com sees testdomain.com as the referral site
  • Data is gathered via Google Analytics

I am unsure as if this PHP code will take care of it, or not -

header("Location: http://google.com", true, 303);

I could test and that is most likely what I am going to do. But I would like to understand a little more as to WHY this would or WHY this wouldn't work.

share|improve this question
add comment

2 Answers

I believe that the "Referer" field is controlled on the client browser. There is nothing that you can do to guarantee that the operation that you want will happen. Browsers can choose to send a fixed/false referer or none at all.

The RFC does not seem to indicate that the referer needs to be preserved either way.

Because the source of a link might be private information or might reveal an otherwise private information source, it is strongly recommended that the user be able to select whether or not the Referer field is sent. For example, a browser client could have a toggle switch for browsing openly/anonymously, which would respectively enable/disable the sending of Referer and From
information.

share|improve this answer
add comment

I don't think it will work the way you want it too. The referer header is controlled by the client. Most browsers only set the referer if you click on a link. They do not set it on redirects.

If a person clicked on a link in Google that linked to testdomain.com, test.com/landing would show them as coming from google. If they typed in testdomain.com they would be redirected and the referer would be blank.

Perhaps you could set up logging on testdomain.com and find out how many people get redirected to test.com/landing.

share|improve this answer
add comment

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.