Blog IT

To perform a redirect in PHP, we use the header() function. This function sends HTTP headers to the server. To perform a redirection, you must send the Location header: followed by the URL of the new page. For this to work, it is advisable to use an absolute URL. A relative URL will however be taken into account in most cases. You must not display any text or HTML before, otherwise it will trigger the display of an error. It is advisable to systematically use the die() or exit() function just after, in order to avoid the case of robots not understanding the HTTP redirections and which continue the execution of the code.

<?php
  header('Location: http://www.blog-it.tn');
  exit();
?>