I'm trying to blank the referrer but my code isn't working (this is for my own testing purposes only) 1st call the script with a htaccess file from https to http (which should blank it) htaccess: RewriteEngine On RewriteRule image.png https://dom1.comscript1.php [R,L] Code (markup): script1: <?php $url = 'http://dom2.com/script2.php'; header("Location: ".$url); ?> Code (markup): script2: <?php $show = 1; if (!empty($_SERVER['HTTP_REFERER'])) { $goodreferer = 0; } else { $goodreferer = 1; } if ($show == 1 && $goodreferer == 1) { header('Location:' . http://someurl.com); } else { header('Location:' . $image); exit; } ?> Code (markup):
The referrer value can't be changed on the server side, all you can do is trick the browser into giving a null referrer. Hence your php script won't work, why don't you use redirect through short linking service ? I'm using a few including lynkto.net, linkonym.com and so on.