Segue abaixo neste tutorial exemplo de como utilizar esta função do php para:
* Redirecionar por mudança permanente 301 moved permanently (redirect):
<?php header('HTTP/1.1 301 Moved Permanently'); header('Location: http://www.example.com/novo_diretorio/'); ?>
* Redirecionar 302 moved temporarily(redirect):
<?php header('Location: http://www.example.com'); ?>
* Desabilitar browser cache (force browsers not to cache files):
<?php header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); header('Cache-Control: no-store, no-cache, must-revalidate'); header('Cache-Control: pre-check=0, post-check=0, max-age=0'); header ('Pragma: no-cache'); ?>
* Forçar mensagem de download:
<?php header('Content-Disposition: attachment; filename=' . urlencode($f)); header('Content-Type: application/force-download'); header('Content-Type: application/octet-stream'); header('Content-Type: application/download'); header('Content-Description: File Transfer'); header('Content-Length: ' . filesize($f)); echo file_get_contents($f); ?>