Free Web Hosting Forum
Go Back   Free Web Hosting Forum > Website Building > Web Programming
Reload this Page HTTP redirect with header function does not work on server16.000webhost.com
Reply
 
Thread Tools Display Modes
(#1 (permalink))
Old
echo442's Avatar
Senior Member
echo442 is on a distinguished road
 
Posts: 173
Join Date: Feb 2012
Location: UK
Post HTTP redirect with header function does not work on server16.000webhost.com - 07-13-2012, 03:04 PM

HTTP redirect with header function does not work on server16.000webhost.com
but it works on other server eg server35.000webhost.com
Quote:
<?php
session_start();
if (isset($_SESSION['user'])){
?>
<html>
<head>
<title>
Admin Panel
</title>
</head>
<body>

</body
</html>
<?php
} else {
header("Location: http://echo2.site40.net/cms/admin/login.php" );
}
?>
test page: http://echo2.site40.net/cms/admin not working | test page 2 (http://br-de.tk/css working)
Reply With Quote
Sponsored Links
(#2 (permalink))
Old
Senior Member
grace1004 is on a distinguished road
 
Posts: 736
Join Date: Dec 2010
Default 07-14-2012, 01:17 AM

session_start() function sends out several HTTP headers, which are not displayed on the browser.
Before header() function if there are HTTP headers, header() function does not work.
Please try again after changing your code as shown below:

From: header("Location: http://echo2.site40.net/cms/admin/login.php" );

To: echo("<meta http-equiv='Refresh' content='0; URL=http://echo2.site40.net/cms/admin/login.php'>");

Last edited by grace1004; 07-14-2012 at 02:07 AM.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.5.2
vBulletin Skin developed by: vBStyles.com