Try This code if(isset($_SESSION['stdid'])) { ob_start(); header("Location: https://sharpexam.000webhostapp.com/stdwelcome.php"); exit(); } else { echo "Some .