So I'm trying to change the headers in PHP with this code:
header("HTTP/1.0 404 Not Found");
And I get the following error message:
Cannot modify header information - headers already sent by (output started at path\index.php:1)
So I've read about this error, and I found out that it happens because an output is already sent before I'm trying to change the headers. Problem is it tells me that output is sent in index.php
on line 1, yet line 1 on that file is:
<?php
I've checked and there is no whitespace characters before the <
. I even tried to change the first line of the file to:
<?php header("HTTP/1.0 404 Not Found");
Yet I still get the same error.
Why does this happen and how can I solve it?