diff --git a/application/config/config.php b/application/config/config.php index c4c78123..c0c81638 100644 --- a/application/config/config.php +++ b/application/config/config.php @@ -14,7 +14,18 @@ | path to your installation. | */ -$config['base_url'] = Config::BASE_URL; + +$protocol = + (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') + || (isset($_SERVER['SERVER_PORT']) && (int)$_SERVER['SERVER_PORT'] === 443) + || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') + ? 'https://' : 'http://'; + +$domain = $_SERVER['HTTP_HOST'] ?? 'localhost'; + +$request_uri = dirname($_SERVER['SCRIPT_NAME']); + +$config['base_url'] = $protocol . $domain . $request_uri; /* |--------------------------------------------------------------------------