Skip to content

Instantly share code, notes, and snippets.

@devyfriend
Last active December 11, 2015 16:08
Show Gist options
  • Save devyfriend/4625062 to your computer and use it in GitHub Desktop.
Save devyfriend/4625062 to your computer and use it in GitHub Desktop.
modified codeigniter config file, useful to detect the server in http or https, especialy when the app is inside an iframe
$referer = isset($_SERVER['HTTP_REFERER']) ? parse_url($_SERVER['HTTP_REFERER']) : false;
$scheme = isset($referer['scheme']) ? $referer['scheme'] : 'http';
$config['base_url'] = $scheme.'://'.$_SERVER['HTTP_HOST'].'/';
$config['scheme_url'] = $scheme;
$config['asset_url'] = $config['base_url'].'assets/';
$config['index_page'] = ''; // empty it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment