I did my research - and found some solutions on this, but for some reason mine still doesn't work!
Using IIS to host a local site redirect works fine, however, when I put it on my web server, the redirect does not work.
Below is a snippet of code from my "myaccount.php" page.
<?php session_start(); if ($_SESSION['LoggedIn'] == true) { // ... Display page... lots of code here } else // Session not active. { // Redirect to login page. header("Location: http://{$_SERVER['HTTP_HOST']}/2ndassign/login.php"); } ?>
When this page is hosted on the net, I just get an empty "myaccount.php" ... redistribution does not occur. There is no space that should lead to an error.
So, I have reduced my code to this so that it is as simple and simple as possible. Error reporting is enabled, so it no longer presents a blank page, but spits out any errors.
<?php error_reporting(E_ALL); ini_set('display_errors', 'On'); header("Location:http://{$_SERVER['HTTP_HOST']}/2ndassign/login.php"); ?>
You can browse the site at www.candlesoft.com.au/2ndassign/myaccount.php. This can help you help me - see what errors spit out.
My courage tells me this with my hosting provider.
CODE ON PASTEBIN is myaccount.php from www.candlesoft.com.au/2ndassign/myaccount.php. This is not an excerpt, this is the whole file. (Indicates that spaces do not cause errors) http://pastebin.com/FUHPpT5A
It turns out the error was that I needed to save the file as UTF-8 (without specification) ... PHP seems to interpret certain characters that the BOM generates as whitespace - better explained here: How to fix "Headers already sent "PHP bug Thanks Billy2mates for the link!