NYCPHP Meetup

NYPHP.org

[nycphp-talk] Help -- header redirection problem

Carlos A Hoyos cahoyos at us.ibm.com
Wed Sep 27 09:59:36 EDT 2006


Without running it, I'd say this script makes an infinite loop. When the
redirect is sent, isn't the else being executed again?

> Bork? Is that in the dictionary?!
>
> I just completely isolated the script down to this:
>
> <?
> $sslmode = 'https';
> $domain = $_SERVER['HTTP_HOST'];
> $uri = $_SERVER['REQUEST_URI'];
> $path = $domain.$uri;
> $sslon = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? true
> : false;
> if ($sslmode == 'http' && $sslon) {
>    header("Location: http://$path");
>    exit;
>    }
> elseif ($sslmode == 'https' && !$sslon) {
>    header("Location: https://$path");
>    exit;
> }
> else {
>    header("Location: https://$path");
>    exit;
> }
> ?>
>
> This fails, but comment out the last header and exit in the else and it
> work. Perhaps I have been borked. Where do I check for
> borking/mod_rewrite? Next step is to download PHP 5.1.6 to see if that
> solves the problem.
>
> Cliff

Carlos




More information about the talk mailing list