NYCPHP Meetup

NYPHP.org

[nycphp-talk] Help -- header redirection problem

Billy Reisinger billy.reisinger at gmail.com
Tue Sep 26 23:09:03 EDT 2006


http://en.wikipedia.org/wiki/Bork

On Sep 26, 2006, at 8:41 PM, Cliff Hirsch wrote:

> 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
>
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php




More information about the talk mailing list