I've developed my website on localhost, and I upload all the files on the server now. Unfortunately, when I go to the account page while I'm not connected, the redirection using the header('Location: /login') function isn't working. I've tried many solutions, like using the function ob_start() and ob_end_flush(), but it still doesn't work. I've also tried to change the paths, without any good results.
account.php
logged_only();
require 'includes/needed.php';
// ...
logged_only() function
function logged_only()
{
if (!isset($_SESSION['auth'])) {
header('Location: /login');
exit();
}
}
Hope you can help me