I tried to use getenv('HTTP_REFERER') to get the referring url ie find out where my user came from... but on localhost i keep getting a blank...

I checked phpinfo() and the referrer was in fact blank...

Is this normal behaviour?

That Aussie Bloke

PS it is spelt HTTP_REFERER and not HTTP_REFERRER because some programmer at the time didnt spell it correctly

What browser are you using? Did you test another browser?

Also are you clicking from a link on another URL?

Yes, referer is in the HTTP Protocol Specs. lol. mispelled of course.. ;)


HTTP_REFERER is an optional header that clients our allowed to omitt according to the HTTP specification. But having said that most major browsers do set it.

It wont be set if you load the page directly i.e. enter the link directly but if you have clicked a link and come from another page then it will be set. (on localhost as well as it is browser set not server set).

As previously asked what browser are you testing with.

a simple check is


<a href="refer.php" >Link To refer</a>


//$_SERVER is the golbal variable for much the same as getenv
echo $_SERVER;
//should output on localhost http://localhost/torefer.html