thanks for your interest. I have found some interesting results (for me at least) from your test script….
1. I copied the code into a file which I saved as Test.php in my controllers directory, as expected.
2. When I tested URL localhost/code/Test.php, it came up with an error.
A PHP Error was encountered
Message: Cannot modify header information - headers already sent by (output started at [~]/web/code/application/libraries/Profiler.php:1)
Line Number: 487
(Please Note: I edited the path of the file, but the Profiler.php class in error was a Library class that I wrote.)
...So this all told me that there was a problem with my library class file. I must have checked the file 10 times, and there was no way there was a leading, or trailing space, with respect to the <?php, and ?> tags respectively.
3. I turned buffering=On in my php.ini file and your Test.php file worked as expected. Turned output_Buffering=Off and it didn’t.
4. So I went back and looked at everything about that file. And as I use Textmate, and on a Mac, I looked at the encoding of the file and the line terminations - UTF8 (Recommended) and CRLF (where LF is Recommended). The file was also designated as a HTML bundle in Textmate - which was probably due to organic movement of code as I developed.
5. So I copied all the code in the file, and put it into a brand new file, saving it first time as a .php, and making sure the editor had all the php encodings set properly - UTF8 and LF.
6. Bingo! This worked a treat. (php.ini has output_Buffering=Off, and no redirect issues at all! Yippee).
I haven’t taken any additional time to delve into whether it was the file bundle settings or the line feed character settings, as I need to hit my deadline. But I hope this (long winded) description can help, anyone on the formus, if another falls into this niche problem I have had.
BTW - appreciate the code snippet, really appreciate it.