nezbo Posted July 24, 2007 Share Posted July 24, 2007 Hi all I am trying to Redirect from one page to another and it wont let me use... header( 'Location: http://www.yoursite.com/new_page.html' ) ; so is there any other way of doing this ? Neil Link to comment https://forums.phpfreaks.com/topic/61502-redirecting-not-using-header/ Share on other sites More sharing options...
vbnullchar Posted July 24, 2007 Share Posted July 24, 2007 make sure there is no output yet on the browser before using header(); or you can use javascript to redirect Link to comment https://forums.phpfreaks.com/topic/61502-redirecting-not-using-header/#findComment-306129 Share on other sites More sharing options...
Fadion Posted July 25, 2007 Share Posted July 25, 2007 As vbnullchar said you must use 'header' before sending any output to the browser. An alternative could be the meta refresh which is as following: <meta http-equiv="refresh" content="0;URL=http://www.phpfreaks.com" /> Link to comment https://forums.phpfreaks.com/topic/61502-redirecting-not-using-header/#findComment-307116 Share on other sites More sharing options...
Ninjakreborn Posted July 25, 2007 Share Posted July 25, 2007 I recommend javascript over meta refresh. You can easily find any examples by googling (Javascript refresh). Link to comment https://forums.phpfreaks.com/topic/61502-redirecting-not-using-header/#findComment-307117 Share on other sites More sharing options...
plutomed Posted July 25, 2007 Share Posted July 25, 2007 if you ever have a header(); after any HTML it won't work, you have to put: <? ob_start(); ?> before all code and: <? ob_end_flush(); ?> after all code. Link to comment https://forums.phpfreaks.com/topic/61502-redirecting-not-using-header/#findComment-307120 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.