Return to Snippet

Revision: 33055
at October 5, 2010 14:40 by traeregan


Initial Code
	// 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;

Initial URL


Initial Description


Initial Title
CodeIgniter Dynamic base_url

Initial Tags
codeigniter

Initial Language
PHP