Looking for somewhere to host your site? Browse our PHP web hosts section!

Home > Code Snippets > Page redirect

Page redirect

Description

If you want a PHP redirect script that redirects visitors from a page to a specific URL then this is it. It sends the user from one web page to a different web page address. It is a good alternative to using the meta tag http-equiv option.

The code


<?php


/**
 * Place in a blank PHP page
 */

// Change to the URL you want to redirect to
$URL="http://www.example.com";

header ("Location: $URL");

?> 

Get the code

Download the file to your computer: Click here to get the file