Skip to content

Instantly share code, notes, and snippets.

@onubadev
Created February 3, 2017 10:41
Show Gist options
  • Save onubadev/3ba272d8cee68dcc49892d22e7bac4fd to your computer and use it in GitHub Desktop.
Save onubadev/3ba272d8cee68dcc49892d22e7bac4fd to your computer and use it in GitHub Desktop.
Codeigniter dynamic HTTP/HTTPS base url
#in config.php
$root=(isset($_SERVER['HTTPS']) ? "https://" : "http://").$_SERVER['HTTP_HOST'];
$root.= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);
$config['base_url'] = $root;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment