Skip to content

Instantly share code, notes, and snippets.

@jehoshua02
Created November 27, 2011 02:22
Show Gist options
  • Save jehoshua02/1396821 to your computer and use it in GitHub Desktop.
Save jehoshua02/1396821 to your computer and use it in GitHub Desktop.
determining the app url
<?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