Cannot modify header information

My code was working well on localhost. whenever i click logout, it doesn’t redirect to my login page. here’s my code:

<?php session_start(); if(!isset($_SESSION['irecord'])){ header("Location: ..\index.php"); } if (isset($_SESSION['type'])) { $type=$_SESSION['type']; if ($type=="admin") { header("Location: \irecord\admin\index.php"); } elseif ($type=="student") { header("Location: \irecord\student\index.php"); } } if(isset($_GET['logout'])){ session_destroy(); unset($_SESSION); echo "ss"; header("Location: ..\index.php"); } ?>

Try

add php_value output_buffering 1 to your .htaccess file in the root directory.

Thank you so much! It solves my problem.

1 Like