1. Computing

Discuss in my forum

Redirect Old Pages to New URLs

Don't have dead pages, redirect to new URLs

By , About.com Guide

Sometimes when you redo your website, you end up with different page names, and pages that no longer exist. When this happens, you don't want people surfing into your old dead pages from links or buried search engine listings... or worse, receiving a 404 page does not exist error.

One way to avoid this is to have old pages redirect to the new page with similar content, or to the home page. This way a user is still kept on your site, even if the page they linked to does not exist.

How to redirect:

 <?php
 header( 'Location: http://www.yoursite.com/new_page.html' ) ;
 ?>
The code above, when placed alone in a file, will redirect a user to the page you specify. You can learn more about page redirection here.

What if your page is a .html, .htm, or some other non PHP page??

One option is to set your HTML pages to run PHP. This way the same code as above will also work for you. Another option is to resort to a meta refresh, which is simply HTML that will redirect you page.

Related Video
How to Link Pages Within a Website
Using PHP With HTML
  1. About.com
  2. Computing
  3. PHP / MySQL
  4. Learn PHP
  5. Moved Pages - Redirect Old Pages - Redirect Moved Pages

©2013 About.com. All rights reserved.