$nerden = $_SERVER['HTTP_REFERER']; $site = "http://localhost"; $say = strlen($site); $kes=substr($nerden,0,$say); if($kes!=$site){ header("location:index.php"); }