How to redirect pages using a 301 redirect and the .htaccess file
301 redirect is the most efficient and Search Engine Friendly method for webpage redirection. It is very easy to implement and it should preserve your search engine rankings for that particular page.
If you have to change file names or move pages around, it’s the best option to preserve your rankings and incoming traffic. The code “301″ is interpreted as “moved permanently”.
Redirect to www
Create a .htaccess file with the below code, it will ensure that all requests coming in to domain.com will get redirected to www.domain.com
The .htaccess file needs to be placed in the root directory of your old website (i.e the same directory where your index file is placed)
Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]
Please REPLACE domain.com and www.newdomain.com with your actual domain name.
Note* This .htaccess method of redirection works ONLY on Linux servers having the Apache Mod-Rewrite moduled enabled.
Redirect a Single Page
Add the following text to your .htaccess file and upload to the base directory of your website.
Redirect 301 /oldpage.html /newpage.html
So, for example, you changed your domain, it would be:
Redirect 301 http://olddomain.com http://newdomain.com
Redirect 301 /pagename.php http://newdomain.com/newpagename.php