HTTP Header

<?php
	/* Specify content language */
	header('Content-language: en');
	
	/* Specify content length */
	header('Content-Length: 3837');
	
	/* Specify content type and character set */
	header('Content-Type: text/html; charset=utf-8');
	
	/* Mention last modified date of the page content */
	header('Last-Modified: Fri, 21 Nov 2014 7:30:00 GMT');
	
	/* Mention expire date of the page content */
 	header('Expires: Expires: Sat, 16 Apr 2015 05:07:07 GMT');
 	
 	/* Request to cache content of the page in client browser */
 	header('Pragma: cache');
 	header('Cache-Control: max-age=172800, public');
 	header('User-Cache-Control: max-age=172800, public'); 
 	
 	/* Authenticate user by HTTP authentication */
 	header('WWW-Authenticate: Basic realm="Restricted Area...Please Authenticate"');
	
	/* Handle requests for missing file */	
	header('HTTP/1.1 404 Not Found'); 
	/*					or					*/
	header($_SERVER["SERVER_PROTOCOL"].' 404 Not Found');
	
	/* Redirect page to different location */
	header('Location: http://www.geekboots.com');
	
	/* Redirect page on 301 permanently moved */
	header('Location: http://www.geekboots.com', TRUE, 301);

	/* Redirect page on 302 found */
	header('Location: http://www.geekboots.com', TRUE, 302);

	/* Redirect page on 303 see other */
	header('Location: http://www.geekboots.com', TRUE, 303);

	/* Redirect page on 307 temporary redirect */
	header('Location: http://www.geekboots.com', TRUE, 307);
	
	/* Output a PDF */
	header('Content-Type: application/pdf');
	
	/* Called download.pdf */
	header('Content-Disposition: attachment; filename="download.pdf"');

?>



/* Output */
Code will reflection on HTTP header.

Comments (0)

  • To add your comment please or

We use cookies to improve your experience on our site and to show you personalised advertising. Please read our cookie policy and privacy policy.

Got It!