Skip to content

Instantly share code, notes, and snippets.

@otengkwame
Forked from onubadev/gist:3ba272d8cee68dcc49892d22e7bac4fd
Last active August 27, 2018 16:56
Show Gist options
  • Save otengkwame/9dfd82c506b7f192126d4cad7e689793 to your computer and use it in GitHub Desktop.
Save otengkwame/9dfd82c506b7f192126d4cad7e689793 to your computer and use it in GitHub Desktop.
Codeigniter dynamic HTTP/HTTPS base url
#in config.php
$base_url=(isset($_SERVER['HTTPS']) ? "https://" : "http://").$_SERVER['HTTP_HOST'];
$base_url.= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);
$config['base_url'] = $base_url;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment