Purpose: Automatically forward visitors to a new page
Code: HTML
Example: See this function in action
Designing Web Usability: The Practice of Simplicity by Jakob Nielsen, 1999. Every person serious about creating, designing, managing, programming or maintaining a web site should read this book. Absolutely great. Do not miss this book. Read his article on Fighting Linkrot.
As Jakob Nielson spells out in his article on Fighting Linkrot: "Any URL that has ever been exposed to the Internet should live forever: never let any URL die."
The best method to redirect is to use a search engine friendly 301 redirect. Example for coldfusion (remove the *) - if I don't include the * then this page is redirected so you can't see it:
PHP 301 redirect:
A less optimal method is to use a Meta Refresh to automatically forward visitors to the new page, whenever needed. If you can't get a 301 redirect working then Meta Refresh is an acceptable alternative.
Even if you use a Meta Refresh command you should include a message with the link to the new page to the body of visitors browser window so they can click on the link if they wish (or need to if the Meta Refresh does not work for some reason).