Jump to content

php redirect


aschandra27

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.