PHP header() function
This function is used to redirect a page to a different url, to set the content type and to tell a browser to not cache the web page.
Syntax
header(string $header, bool $replace, int $http_response_code);
The string $header is the header string, $replace indicates whether the header replace a previous similar header, $http_response_code is a special value, that shows whether the response is successful or not.
Redirect Url
Example
<?php
header('Location: http://www.example.com');
?>
Set Content Type
Example
<?php
header('Content-Type: text/css');
header('Content-Type: text/javascript');
header('Content-Type: text/plain');
header('Content-Type: text/xml');
?>
Set no cache to page
Example
<?php
header("Pragma: no-cache");
?>