views:

346

answers:

2

I'm using a standard htaccess ErrorDocument 404 to redirect users to a new page. In order to customize the 404, I need to know their referrer information (from the page they Tried to visit).

$_SERVER['HTTP_REFERER'] is empty

I printed out all of my global variables and most contain the link to pageNotFound.php.

How can I retrieve this information? (Server-Side is preferred)

+2  A: 

It should be in $_SERVER['HTTP_REFERER'] Yours is mispelled.

wallyk
And so we get onto why you should always run a spell checker over your standards documents **before** submitting them...
Matthew Scharley
Actually, technically the OP spelled referrer correctly. Sadly, the misspelling is in the HTTP spec.
Asaph
Sorry typo on my part, but even so I'm left with null:http://www.speedcountry.com/page/not_a_real_page.php (last one)
Paul Silvis
Nevermind. I'm a moron. Thanks for your help
Paul Silvis
It works fine. There I get ...HTTP_HOST : www.speedcountry.comHTTP_REFERER : http://stackoverflow.com/questions/1760749/errordocument-404-not-sending-referrer-information-php/1760759HTTP_USER_AGENT : Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 (.NET CLR 3.5.30729) ...
wallyk
@Asaph: It doesn't matter how it's spelled in English, the way that it is spelled in the spec is the correct way of spelling it (in this context).
Matthew Scharley
+1  A: 

HTTP_REFERER doesn't have a double r. It's an unfortunate misspelling in the HTTP spec.

Asaph