Skip to content

Instantly share code, notes, and snippets.

@nathan-isaac
Created October 24, 2013 23:40
Show Gist options
  • Save nathan-isaac/7147050 to your computer and use it in GitHub Desktop.
Save nathan-isaac/7147050 to your computer and use it in GitHub Desktop.
Get full Site URL including "HTTP" or "HTTPS".
function siteURL()
{
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
$domainName = $_SERVER['HTTP_HOST'].'/';
return $protocol.$domainName;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment