There are various types of page redirection. they are listed below with a small description. You can also redirect with other programming languages not shown here such as javascript (other methods here)
meta http-equiv="refresh"...
This is highly frowned on by search engines and is commonly used by spammers. As such, THIS SHOULD BE AVOIDED.
{geshibot language="html"}
301 Redirect without mod_rewrite - These are done in the .htaccess file.
301 means permanent redirect and 302 means temporary redirect. 301 is the prefered option.
301 Redirect Old File
Redirect 301 /old/file.html http://www.askapache.com/new/file.html
301 Redirect Entire Directory
RedirectMatch 301 /blog(.*) http://www.askapache.com/$1
301 Redirect Entire Site to a New Domain
Redirect 301 / http://www.askapache.com
301 Redirects using mod_rewrite - These are done in the .htaccess file.
For these to work the mod_rewrite engine must be on. It can be turned on by add the follwing line before your rewrite rules. Rewrite base is only really required if your site is in a sub folder.
RewriteEngine On RewriteBase /
This a basic rewrite rule below, however mod_rewrite is more poverful that Redirect or RedirectMatch because it can handle variables, for insatance you can redirect search queries.
RewriteRule .* http://www.askapache.com/$1 [R=301,L] RewriteRule ^(.*)\.html([^c]+)comment-(.+)$ http://www.askapache.com/$1.html#comment-$3 [R=301,L,NE]
How to 301 Redirect a non WWW to a WWW Domain
RewriteCond %{HTTP_HOST} ^yourhost.com$ [NC] RewriteRule ^(.*)$ http://www.yourhost.com/$1 [L,R=301]
PHP Redirect
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.
Put the following code in to a php file
Example 1
{geshibot lang="php"} {/geshibot}Example 2
{geshibot lang=php"}{/geshibot}NB: Be sure that you do not have any text sent to the browser before this code, or it will not work. Your safest bet is to simply remove all content from the page but the redirect code.