Created
November 27, 2011 02:22
-
-
Save jehoshua02/1396821 to your computer and use it in GitHub Desktop.
determining the app url
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function app_url() | |
{ | |
$protocol = (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') ? 'https' : 'http'; | |
$host = $_SERVER['HTTP_HOST']; | |
$path = str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']); | |
$url = $protocol . '://' . $host . $path; | |
return $url; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment