squiblo Posted July 24, 2009 Share Posted July 24, 2009 if someone types in the homepage (index.php) and they are already logged in, i want them to be redirected to their profile (profile.php) but i have got my thinking all wrong and its just stuck in a loop <?php session_start(); if(!isset($_SESSION['myusername'])){ header("location:index.php"); } else { header("location:profile.php"); } exit; ?> Quote Link to comment https://forums.phpfreaks.com/topic/167264-solved-redirecting/ Share on other sites More sharing options...
rhodesa Posted July 24, 2009 Share Posted July 24, 2009 this is index.php right? so you only want to send them away if they are logged in. otherwise, continue with the page: <?php session_start(); if(isset($_SESSION['myusername'])){ header("location:profile.php"); exit; } ?> Here is the index.php page code Quote Link to comment https://forums.phpfreaks.com/topic/167264-solved-redirecting/#findComment-881904 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.