I thought this would be simple but I can\'t seem to find a variable of $_SERVER array that has what I\'m looking for.
$_SERVER
Let\'s say my url is http://
http://
This worked perfectly for me and seems to be a very clean solution.
$protocol = ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://"; $path = $protocol.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']);