aschandra27 Posted July 18, 2007 Share Posted July 18, 2007 hi i am having a problem with redirect. the page which works fine with my localhost, when copied to a different server doesnt work. the code is below <? session_start(); if(!session_is_registered(myusername)){ header("location:template.php"); } ?> <html> <body> <?php header( 'Location: showrec.php' ) ; ?> </body> </html> when copied to a differnt server it stops redirecting the page and sits there. please help Link to comment https://forums.phpfreaks.com/topic/60529-php-redirect/ Share on other sites More sharing options...
Northern Flame Posted July 20, 2007 Share Posted July 20, 2007 post this in the "PHP Help" section Link to comment https://forums.phpfreaks.com/topic/60529-php-redirect/#findComment-303057 Share on other sites More sharing options...
samtay Posted July 20, 2007 Share Posted July 20, 2007 Try this! <? session_start(); if(!session_is_registered(myusername)){ header("Location: /template.php"); } ?> What is this redirect for? It won't work as the file has already been partly sent and headers can not be sent. <html> <body> <?php header( 'Location: showrec.php' ) ; ?> </body> </html> Need to be like this, before any other HTML code that is not in "<?php ?>", has been echo, print etc <?php header( 'Location: showrec.php' ) ; ?> <html> <body> </body> </html> Unless you are thinking of include here. include will insert an file here. <html> <body> <?php include('showrec.php' ) ; ?> </body> </html> Link to comment https://forums.phpfreaks.com/topic/60529-php-redirect/#findComment-303101 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.