Skip to content

Instantly share code, notes, and snippets.

@BlaM
Created April 8, 2019 09:34
Show Gist options
  • Save BlaM/bdbee22f5400d7b9e7dfef750f539ba6 to your computer and use it in GitHub Desktop.
Save BlaM/bdbee22f5400d7b9e7dfef750f539ba6 to your computer and use it in GitHub Desktop.
if (!defined('__PUBLIC__')) define('__PUBLIC__', __FILE__);
define('SCHEMA', (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https' : 'http');
define('ROOT_LINK', str_replace(array(str_replace($_SERVER['SCRIPT_NAME'], '', $_SERVER['SCRIPT_FILENAME']), basename(__PUBLIC__)), array('', ''), __PUBLIC__));
define('ROOT_URL', SCHEMA . '://' . $_SERVER['HTTP_HOST'] . ROOT_LINK);
define('ROOT_URL_NO_SLASH', substr(ROOT_URL, 0, -1));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment