By using this site you agree to the use of cookies by Brugbart and our partners.

Learn more

PHP Header

Reference on how to use the Header network function of PHP.

Edited: 2013-07-05 12:07

The PHP Header function is used to send HTTP Headers to the browser. Headers must be sent before any output is sent to the browser.

Response Codes

The Header function is also used to deliver response codes, such as 200 ok, 304 Not Modified, and so on.

header('HTTP/1.1 200 OK');

Header Redirect

Redirects are performed with the HTTP Location Header, usually in combination with the relevant status code, such as the 303 See Other status code.

header('HTTP/1.1 303 See Other');
header('Location: http://www.example.com/');

See also

  1. HTTP Response Codes – a list of response codes.