ghosh Posted August 17, 2007 Share Posted August 17, 2007 Hello, Can any one suggest me how do I redirect from one page to another in PHP? I am novice, so keep it simple please. for example if(a>b) { header.Location("http://a.html"); } else { header.Location("http://b.html"); } Is this right code? ??? Quote Link to comment https://forums.phpfreaks.com/topic/65342-redirect-headerlocation/ Share on other sites More sharing options...
MadTechie Posted August 17, 2007 Share Posted August 17, 2007 correct syntax header ("Location: http://b.html"); Quote Link to comment https://forums.phpfreaks.com/topic/65342-redirect-headerlocation/#findComment-326306 Share on other sites More sharing options...
corillo181 Posted August 17, 2007 Share Posted August 17, 2007 header('Location: wherever.php'); the L has to be capital. Quote Link to comment https://forums.phpfreaks.com/topic/65342-redirect-headerlocation/#findComment-326308 Share on other sites More sharing options...
jlp09550 Posted August 17, 2007 Share Posted August 17, 2007 Hello, Can any one suggest me how do I redirect from one page to another in PHP? I am novice, so keep it simple please. for example if(a>b) { header.Location("http://a.html"); } else { header.Location("http://b.html"); } Is this right code? ??? I use, for example: header("Location: http://a.html"); .. and it works fine. Quote Link to comment https://forums.phpfreaks.com/topic/65342-redirect-headerlocation/#findComment-326309 Share on other sites More sharing options...
ghosh Posted August 17, 2007 Author Share Posted August 17, 2007 I got it. Thank you Quote Link to comment https://forums.phpfreaks.com/topic/65342-redirect-headerlocation/#findComment-326313 Share on other sites More sharing options...
ghosh Posted August 17, 2007 Author Share Posted August 17, 2007 when I am typing this code <?php header("Location: http://www.myplanet.co.in/home/home.html"); ?> I am getting this error: Warning: Cannot modify header information - headers already sent by (output started at /home/myplanet/public_html/index.php:1) in /home/myplanet/public_html/index.php on line 2 can you please suggest what could be the error? Quote Link to comment https://forums.phpfreaks.com/topic/65342-redirect-headerlocation/#findComment-326408 Share on other sites More sharing options...
trq Posted August 17, 2007 Share Posted August 17, 2007 Read the massive (HEADER ERROR) sticky posted on the top of this board. Quote Link to comment https://forums.phpfreaks.com/topic/65342-redirect-headerlocation/#findComment-326411 Share on other sites More sharing options...
Neptunus Maris Posted August 17, 2007 Share Posted August 17, 2007 AND just have .htm for saftey of getting to the page not html sometimes .html doesnt work ...also if you wanted to access a file o the same server...just: header("Location: a.htm"); exit; Quote Link to comment https://forums.phpfreaks.com/topic/65342-redirect-headerlocation/#findComment-326421 Share on other sites More sharing options...
ghosh Posted August 17, 2007 Author Share Posted August 17, 2007 Thanks Neptunus Maris, its working Quote Link to comment https://forums.phpfreaks.com/topic/65342-redirect-headerlocation/#findComment-326524 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.