note: There is a similar question but that's about Apache.
The following code
<?php
echo '.';
header('Location: http://stackoverflow.com');
is fully 'working' under nginx 0.7.67 where 'working' means the php redirect is working fine without errors in the error log or displaying the .
.
How can i force nginx or php-fpm to throw the PHP Warning: Cannot modify header information - headers already sent by
warning?
You should check value of
output_buffering
parameter in your php.ini file.php.ini #output-buffering
I had the same problem and I found that it was because a
header("Status: 200 OK", false, 200);
before the header to redirect. So I added a condition not to display the header 200 if I know that I will have to redirect:Note: With Apache I had not this problem and could redirect even after a header 200.