Skip to content

Instantly share code, notes, and snippets.

@aneutron
Created June 13, 2013 22:57
Show Gist options
  • Save aneutron/5778130 to your computer and use it in GitHub Desktop.
Save aneutron/5778130 to your computer and use it in GitHub Desktop.
<?php
function base_url(){
$base_url = is_https() ? 'https' : 'http';
$base_url .= '://'.$_SERVER['HTTP_HOST'].str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);
return $base_url;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment