0

I am trying to get the URL of the site which referred the user to the site with the script on it.

Here is the script I am using:

if (isset($_SERVER['HTTP_REFERER'])) {
    $ref_url = $_SERVER['HTTP_REFERER']; //get referrer
}else{
    $ref_url = 'none'; // show failure message
}
echo $ref_url;

The issue I am having is that no matter what site I come to the main site from, I always get 'none' echoed. What is causing this and how can I make the script actually get the referrers URL?

Toby Cannon
  • 725
  • 6
  • 16
  • 2
    possible duplicate of [In what cases will HTTP\_REFERER be empty](http://stackoverflow.com/questions/6880659/in-what-cases-will-http-referer-be-empty) – Saty Sep 02 '15 at 10:40
  • Thanks for the comment, I did research this before posting and found this post, however this does not help me, as far as I can see my circumstances meet none of the requirements for it to be empty – Toby Cannon Sep 02 '15 at 10:46

0 Answers0