public function getBasehref() {
		$script_name = dirname($_SERVER['SCRIPT_NAME']);
		$script_name = str_replace('\\', '/', $script_name); // for Windows paths
		$path = '/'. trim($script_name, '/') .'/';

		// If it is the root the return value of dirname is slash
		if ($path == '//') $path = '/';
		$scheme = isset($_SERVER['HTTPS']) || isset($_SERVER['HTTP_X_SSL_ACTIVE']) || (isset($_SERVER['SSL_PROTOCOL']) && !empty($_SERVER['SSL_PROTOCOL'])) ? 'https://' : 'http://';

		$host = php_sapi_name() === 'cli' ? gethostname() : $_SERVER['HTTP_HOST']; // Exception for cli
		$base_href = $scheme . $host . $path;

		return $base_href;
	}