HTTP Headers in php

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.

Redirection
<?php
    header('Location: http://www.php.net');
?>
Setting a Last-Modified Header
<?php
 header('Last-Modified: '.gmdate('D, d M Y H:i:s',getlastmod()).' GMT');
?>

Avoid all Caching
<?php
 header('Cache-Control: no-cache, must-revalidate');
 header('Pragma: no-cache');
 header('Expires: Mon,13 Jal 1980 05:00:00 GMT');
?>

Popular posts from this blog

Detecting user's screen size and resolution

autoload class

MySql Slow Queries