kllund
kllund

Reputation: 41

Redirect, but hide referrer

Lets say I have a URL, www.mysite.com/go that I want to redirect to www.anothersite.com/site.php?id=999

The trick is, I do not want anothersite.com to be able to see that the request came from mysite.com. It should look like the address www.anothersite.com/site.php?id=999 was typed into the addressbar manually by the user.

It is important to note, that this has nothing to do with Google Analytics, and there will never exist an anchor link to www.mysite.com/go anywhere. Instead, the user will manually input www.mysite.com/go in the address bar (which is easier to remembar than the long URL).

How is this achieved? The technology in question is PHP. I imagine that it can be achieved with the header() function, but google searches reveal that this only works with https, not http. Can I via PHP control what the client provides of referrel information when the redirect is performed? I guess that if I want it to look like the address was typed into the address bar, I would have to blank out the referrer information. Is it possible?

Upvotes: 3

Views: 3885

Answers (1)

Rudi Visser
Rudi Visser

Reputation: 21979

It's not possible by means of a HTTP Redirect. You don't have any control over the outgoing referrer header as the browser handles it entirely client-side.

Your only real option that you can directly control is to use HTTPS. Referrers with a value of a HTTPS page are not carried forward by browsers.

Example flow:

  1. http://www.mysite.com/go (so any existing links don't have to change)
  2. https://www.mysite.com/go
  3. http://www.anothersite.com/site.php?id=999

Upvotes: 3

Related Questions