NYCPHP Meetup

NYPHP.org

[nycphp-talk] Help -- header redirection problem

Cliff Hirsch cliff at pinestream.com
Tue Sep 26 21:41:21 EDT 2006


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
-----Original Message-----
From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org]
On Behalf Of Rick Olson
Sent: Tuesday, September 26, 2006 7:32 PM
To: NYPHP Talk
Subject: Re: [nycphp-talk] Help -- header redirection problem

One thing that might be causing the issue is a borked/neverending 
mod_rewrite rule...\

Rick Olson wrote:
> I tried the following code just now using multiple URLs, both HTTPS & 
> HTTP, with nested output buffering even, and variations thereof, and 
> have not managed to trigger that error :(
>
> ob_start();
> print 'before';
> print 'do stuff...';
> print 'xxxxxx';
> ob_end_clean();
> header("Location: https://www.paypal.com");
> exit;
>
> Anything else in there that might be causing the problem?
>
> --
> Rick




More information about the talk mailing list