Note that if you don't want to go through the process of making sure that there is no output before you send a header, you can use
at the beginning of your page.
This starts the output buffer, which allows you to send headers whenever you feel like it. Make sure that you put it at the BEGINNING, after the first php tag.
It allows you to do something like
header("Status: 404 Not Found");