function url(){ if(isset($_SERVER[\'HTTPS\'])){ $protocol = ($_SERVER[\'HTTPS\'] && $_SERVER[\'HTTPS\'] != \"off\") ? \"https\" : \"http\"; }
2 lines to solve it
$actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; $myDomain = preg_replace('/^www\./', '', parse_url($actual_link, PHP_URL_HOST));