301 redirect is the most efficient and Search Engine friendly method for webpage redirection. If you have to change file names or move pages around, it's the safest option and preserves your search engine rankings. The code "301" is interpreted as "moved permanently".
With php:
<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://host.domain.tld" );
?>
With mod_rewrite:
RewriteEngine on
#Redirect Old domain to New domain
RewriteRule (.*) http://host.domain.tld/$1 [R=301,L]
# Redirect a particular domain
RewriteCond %{http_host} ^domain\.tld$ [NC]
RewriteRule ^(.*)$ http://host.newdomain.tld/$1 [R=301,L]
# Redirect a particular file
RewriteRule ^old_file.html$ http://host.domain.tld/new_file.html [R=301,L]
Index:
[NC] (No Case): This makes the condition pattern case insensitive, no difference between 'A-Z' and 'a-z'.
[R=301] (force Redirect) : Redirect the URL. Send the HTTP response, 301 (moved permanently). If only [R] is given, the default is "moved temporarily".
[L] (last rule) : Forces the rewriting processing to stop here and don't apply any more rewriting rules.
'.' : Any single character.
'*' : 0 or more of the preceding text.
'^' : Start of line anchor.
'$' : End of line anchor.
'\' : escape particular character.
'(text)' : Grouping of text.
'$1' : Back reference the first group.