views:

36

answers:

2

How can you get the HTTP Referrer when redirected from another website, not when they click on a link since it would work for $_SERVER['HTTP_REFERER'], but it doesn't work when a user has been redirected a website and the referrer would be empty.

What will be the method to get the referrer?

+3  A: 

How can you get the HTTP Referrer when redirected from another website

You can't. If the redirection takes place under your control, you can add the original referer as a parameter, but if the external redirector doesn't do that, you have no way to get hold of the information.

Pekka
Aw. So there is absolutely no way to know where the user came from when the user got redirected?
YouBook
@YouBook not as far as I know, no.
Pekka
A: 

Have a read of this:

http://www.electrictoolbox.com/php-http-referer-variable/

Ergo Summary
This won't help in this specific case, where `REFERER` has a different value
Pekka
@Pekka Did you look at the whole article? It explains why the value may vary and be blank...as in this case.
Ergo Summary
@Ergo I read the whole article. I still think it misses the point. The OP wants to get the referer's referer, which is by definition not possible, unless the previous page passes it on. The cases the article refers to (if I read it right) are when the *client* decides to suppress sending the referer.
Pekka
@Pekka, aha! I didnt read the question as referring to the referrers referrer, merely the immediate referrer (from the page referred), in which case you're right
Ergo Summary