Blu Towers
Blu Towers

Reputation: 2128

Php Apache get referring url

How would i go about retrieving the referring url with either PHP or apache.

I know about $_SERVER['HTTP_REFERER'] which you cant use or trust.

I have found you can get it in javascript with document.referer

But if JS is disabled it wont work, I would prefer not to use JS.

I have been trying to see if that is the only way to do it and looked into bit.ly, they do not use JS.

Is there a way to use Apache logs to find this information or another programming language, completely at a loss as to how i can get this simple bit of information.

Upvotes: 2

Views: 1880

Answers (1)

Apache is going to log the same information as you see in $_SERVER['HTTP_REFERER']. What makes $_SERVER['HTTP_REFERER'] unreliable -- in my understanding -- is that not all user agents send the referer, which is something that Apache won't be able to get around either.

Upvotes: 2

Related Questions