diff --git a/includes/session_check.php b/includes/session_check.php index 2675ff1..930c516 100644 --- a/includes/session_check.php +++ b/includes/session_check.php @@ -24,7 +24,9 @@ function checkSession(): void validateSessionDomain(); if (!isset($_SESSION['user_id'])) { - header('Location: /login.php'); + $scheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http'; + $host = $_SERVER['HTTP_HOST'] ?? 'localhost'; + header('Location: ' . $scheme . '://' . $host . '/login.php'); exit; } }