pklover Posted March 13, 2010 Share Posted March 13, 2010 can any help me ? i want to use php for page redirection like iframe <iframe src="www.mydoamin.com/page.php" width="500" height="450"> </iframe> if this iframe use in my site redirect to www.mydoamin.com/mysitepage.html if this iframe any other use than redirect to www.mydoamin.com/sorry.html Quote Link to comment https://forums.phpfreaks.com/topic/195143-php-page-redirection/ Share on other sites More sharing options...
Tazerenix Posted March 13, 2010 Share Posted March 13, 2010 what? Quote Link to comment https://forums.phpfreaks.com/topic/195143-php-page-redirection/#findComment-1025748 Share on other sites More sharing options...
dreamwest Posted March 15, 2010 Share Posted March 15, 2010 http://wizecho.com/nav=extra&s=bits Quote Link to comment https://forums.phpfreaks.com/topic/195143-php-page-redirection/#findComment-1026141 Share on other sites More sharing options...
plznty Posted March 16, 2010 Share Posted March 16, 2010 <?php header('Location: http://www.yoursite.com/'); ?> Taken from - http://php.net/manual/en/function.header.php Quote Link to comment https://forums.phpfreaks.com/topic/195143-php-page-redirection/#findComment-1026878 Share on other sites More sharing options...
dreamwest Posted March 16, 2010 Share Posted March 16, 2010 <?php header('Location: http://www.yoursite.com/'); ?> Taken from - http://php.net/manual/en/function.header.php Thats ok if your headers havent been sent, othwise youll need javascript: function redirect( $url ){ if (! headers_sent( ) ){ header( "Location: ".$url ); exit( 0 ); } echo "<script language=Javascript>document.location.href='".$url."';</script>"; exit( 0 ); } redirect('http://www.yoursite.com/'); //redirect to any url Quote Link to comment https://forums.phpfreaks.com/topic/195143-php-page-redirection/#findComment-1026961 Share on other sites More sharing options...
KevinM1 Posted March 16, 2010 Share Posted March 16, 2010 <?php header('Location: http://www.yoursite.com/'); ?> Taken from - http://php.net/manual/en/function.header.php Thats ok if your headers havent been sent, othwise youll need javascript: function redirect( $url ){ if (! headers_sent( ) ){ header( "Location: ".$url ); exit( 0 ); } echo "<script language=Javascript>document.location.href='".$url."';</script>"; exit( 0 ); } redirect('http://www.yoursite.com/'); //redirect to any url Even better - code properly, so all of your PHP processing happens before headers are sent. Quote Link to comment https://forums.phpfreaks.com/topic/195143-php-page-redirection/#findComment-1026974 Share on other sites More sharing options...
Tazerenix Posted March 16, 2010 Share Posted March 16, 2010 <?php header('Location: http://www.yoursite.com/'); ?> Taken from - http://php.net/manual/en/function.header.php Thats ok if your headers havent been sent, othwise youll need javascript: function redirect( $url ){ if (! headers_sent( ) ){ header( "Location: ".$url ); exit( 0 ); } echo "<script language=Javascript>document.location.href='".$url."';</script>"; exit( 0 ); } redirect('http://www.yoursite.com/'); //redirect to any url actually your wrong. Location can be called even after the headers have been sent Quote Link to comment https://forums.phpfreaks.com/topic/195143-php-page-redirection/#findComment-1027289 Share on other sites More sharing options...
seventheyejosh Posted March 16, 2010 Share Posted March 16, 2010 actually your wrong. Location can be called even after the headers have been sent Actually you're wrong: You can't add any more header lines using the header() function once the header block has already been sent. http://us.php.net/manual/en/function.headers-sent.php i.e. Once the headers have been sent, manually or from the server, you aren't allowed to send anymore, unless you do something manually with the buffer, like ob_clean() or flush() (i believe...) Quote Link to comment https://forums.phpfreaks.com/topic/195143-php-page-redirection/#findComment-1027334 Share on other sites More sharing options...
Tazerenix Posted March 17, 2010 Share Posted March 17, 2010 i have used header('location') after my header has been sent many times. Seems to work fine for me Quote Link to comment https://forums.phpfreaks.com/topic/195143-php-page-redirection/#findComment-1027438 Share on other sites More sharing options...
trq Posted March 17, 2010 Share Posted March 17, 2010 i have used header('location') after my header has been sent many times. Seems to work fine for me Your dreaming. Quote Link to comment https://forums.phpfreaks.com/topic/195143-php-page-redirection/#findComment-1027441 Share on other sites More sharing options...
Tazerenix Posted March 17, 2010 Share Posted March 17, 2010 no, im not, it works for me Quote Link to comment https://forums.phpfreaks.com/topic/195143-php-page-redirection/#findComment-1027442 Share on other sites More sharing options...
Daniel0 Posted March 17, 2010 Share Posted March 17, 2010 It's because you're using output buffering. It's per definition not possible to send a header once the body in an HTTP response has been sent. Go read the RFC. Quote Link to comment https://forums.phpfreaks.com/topic/195143-php-page-redirection/#findComment-1027453 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.