HTTP Headers

You can add headers to the HTTP response in PHP using the header() function. Since the response headers are sent before any of the actual response data, you have to send these headers before outputting any data. So, put any such header calls at the top of your script.


<?php header('Location:')?>

Setting a Last-Modified Header


    header('Last-Modified: '.gmdate('D, d M Y H:i:s',getlastmod()).' GMT');



Show all Sent Headers


if (headers_sent()) {
    foreach (headers_list() as $hdr) echo $hdr.'<br>';


Avoid all Caching


header('Cache-Control: no-cache, must-revalidate');

header('Pragma: no-cache');

header('Expires: Mon,26 Jul 1980 05:00:00 GMT');


Loading ...

Related Results :

  1. HTTP Headers
Note :
  • Related Posts are generally User Blog posts.
  • or Other tutorials from other networks of
  • Any registered user can create related posts based on search term tags.

About the Author