// Determine Subdirectory of Install Path, If Any
// If Not Present, Will Result in /
$slash = explode('/', getenv("SCRIPT_NAME"));
$current_filename = $slash[count($slash) - 1];
$host_url = str_replace($current_filename, "", getenv("SCRIPT_NAME"));
// If https being used, set base_url to https
$http_or_https = (!isset($_SERVER['HTTPS']) OR strtolower($_SERVER['HTTPS']) != 'on') ? 'http' : 'https';
$config['base_url'] = $http_or_https ."://". $_SERVER['HTTP_HOST'].$host_url;