0

I am unable to catch the Referrer using PHP:

$_SERVER['HTTP_REFERER'];

when visitors come to mywebsite.com from an external-web-site.com via a link with target="_blank", for ex:

   ...    
   <a href="http://mywebsite.com" target="_blank">Link to My WebSite</a>
   ...

It always returns empty result instead of the external-web-site.com

Does it possible to correctly obtain external-web-site.com, lets say using combination of JavaScript and PHP or something else?

Thanks in advance!

Murat Korkmaz
  • 1,329
  • 2
  • 19
  • 37
  • 2
    Possible duplicate to http://stackoverflow.com/questions/165975/determining-referer-in-php ? – Brendan Feb 21 '12 at 15:56
  • 1
    Please see this answer: http://stackoverflow.com/questions/5643773/http-referrer-not-always-being-passed – Roman Goyenko Feb 21 '12 at 15:58
  • Why do you need to know the referrer in this way? – Explosion Pills Feb 21 '12 at 16:19
  • Because some visitors came to my web-site from blogs via links with target="_blank", and there are no way to track this. Google Analytics doesn't show this info also. – Murat Korkmaz Feb 22 '12 at 08:32
  • 1
    Romario and Brendan, than for referring me to other posts. I seen them, and they didn't help me. Seems (thanks to web-browser developers) it's impossible to track 70% of external referrers (most of them in my case are came from blogs. – Murat Korkmaz Feb 22 '12 at 08:50

1 Answers1

0

I think i found this problem solution. I am suggesting that i have one php file. So i want direct and _blank link rediret ru.example.com and referred link az.example.com. And i have this link az.example.com/index.php?id=123 i want _blank link from facebook.com or another site my page not redirect. Only redirect index.php

so

index.php source code:

<?php
$refer = $_SERVER['HTTP_REFERER'];
...
if($id<>null){
...
}else{
if($refer==null){
header('Location:http://ru.example.com/');
}
...
}
?>