$isHttps = !empty($_SERVER['HTTPS']) && 'off' !== strtolower($_SERVER['HTTPS']); $isHttps ? $preUrl = 'https://' : $preUrl = 'http://'; $currentUrl = $preUrl . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; ?>