RE: [PHP] Location header does not work?
| From: | Ford, Mike [LSS] | Date: | Thu, 05 Aug 2004 16:12:22 +0000 |
| Subject: | RE: [PHP] Location header does not work? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-192890@lists.php.net to get a copy of this message | ||
On 05 August 2004 16:36, Bing Du wrote:
> I really appreciate everyone who responded taking your valuable time
> looking into my problem.
>
> Now back to my problem. Changing the condition to
> "if($_SERVER['HTTPS']
> != 'on')" did not make any difference unfortunately. So the result was
> still the URL in the Address box of the browser changed to
> https://computing.eng.iastate.edu/mambo/index.php?option=conte
> nt&task=view&id=159&Itemid=162
> fine. But instead of showing the page that https address
> should point to,
> 'You are in HTTPS mode' was displayed as the else clause specified.
Right, you're obviously not getting this, so let's take it step by step.
(1) Your browser requests
https://computing.eng.iastate.edu/mambo/index.php?option=content&task=view&i
d=159&Itemid=162
(2) This fires the script /mambo/index.php on your server.
(3) Script finds all conditions in the first if() are met, so tests
$_SERVER['HTTPS'].
(4) ... finding it is not set, it issues a Location: redirect to
https://computing.eng.iastate.edu/mambo/index.php?option=content&task=view&i
d=159&Itemid=162
(5) Browser sees the redirect, and issues a new request for
https://computing.eng.iastate.edu/mambo/index.php?option=content&task=view&i
d=159&Itemid=162; at this point, it also changes the URL displayed in its
address bar.
(6) This seems to be where you are confused -- WHICH PAGE DO YOU THINK THIS
IS GOING TO LOAD?
(6a) Server sees new request, this time via https, to exactly the same
script as before, so fires the script /mambo/index.php again.
(7) See (3).
(8) This time it finds $_SERVER['HTTPS'] is set (or =='on', depending), and
echos 'You are in HTTPS mode'.
(9) QED
Which step isn't what you were expecting?
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS, LS6 3QS, United Kingdom
Email: m.ford@leedsmet.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211