$x = substr($_SERVER['HTTP_REFERER'],0,5); if($x =="http:") { $protokol = "http://"; } else { $protokol="https://"; }