ErrorDocument 404 Not Sending Referrer Information: PHP

1.3k Views Asked by At

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

There are 2 best solutions below

5
On BEST ANSWER

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

0
On

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