Praveen's Blog

An Eternal Quest for Incremental Improvement

URL redirection using PHP

Here is an one-liner PHP code for URL redirection instantly.

<?php
  header( 'Location: http://www.yoursite.com/new_page.html' ) ;
?>

Make sure that you don't do send any HTML before doing this. The following is not going to work.

<html>
...
<?php
  header( 'Location: http://www.yoursite.com/new_page.html' ) ;
?>
...
</html>

Comments