http://php.net/manual/function.header
The basic “header” function lets you send any header you want to the client. You can send any “Header: value”, and you can also set the return code:
header("HTTP/1.1 404 Not Found");
header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found");
However, it makes it easier to set the response code. This is especially useful for redirects:
header("Location: http://www.example.com/new/location/", true, 301);