How to Redirect with PHP


You can use a simple PHP script to redirect a user from the page they entered to a different web page.

  • Users are redirected quickly and seamlessly
  • When using the ‘Back’ button, the user is taken to the last viewed page, not the redirect page
  • Works on all browsers


Change the code on the redirect page to be:


   header( 'Location:' ) ;


You need to replace the URL above with the URL you wish to direct to.

Be sure that you do not have any text sent to the browser before this, or it will not work. Your safest bet is to simply remove all content from the page but the redirect code.


  1. Remove all code but this redirect script.
  2. Mention on the new page that users should update their links and bookmarks.
  3. You can use this code to create a drop-down menu that redirects users pages.