1) Header in PHP
Function
header () sends the raw HTTP header to the client.
<?php header("HTTP/1.0 404 Not Found"); ?>
The above (taken from the PHP documentation) sends back to client 404.
2) HTTP redirection
Redirect to the specified URL.
<?php http_redirect("relpath", array("name" => "value"), true, HTTP_REDIRECT_PERM); ?>
Above (taken from PHP documentation): Exit
HTTP/1.1 301 Moved Permanently X-Powered-By: PHP/5.2.2 Content-Type: text/html Location: http://www.example.com/curdir/relpath?name=value&PHPSESSID=abc Redirecting to <a href="http://www.example.com/curdir/relpath?name=value&PHPSESSID=abc">http://www.example.com/curdir/relpath?name=value&PHPSESSID=abc</a>.
source share