For the first time since using $_SERVER['HTTP_REFERER']
it gives me NULL
as a result.
When I do开发者_运维知识库 var_dump($_SERVER)
the HTTP_REFERER
key does not exist.
I also try to visit site with different browsers and from different sites but with no result.
The website is running on a Linux/Apache based server.
How do I fix this?
Not all browsers will send the HTTP Referer header - you can't rely on it being sent. For instance, there are plenty of privacy addons which will disable sending of the header, or always send something specific rather than the real referring URL.
A proxy between you and the server could also choose not to pass on this header.
Also, of course, if you've gone straight to the URL in question, there is no referring URL to report.
The Referer
HTTP header is optional : clients can choose not to send it (or to send a false value).
This means you application can use it -- but must not depend on it.
精彩评论