301 .htaccess redirect is the safest search engine redirect there is! This is also the friendliest method for web page redirection. Most web hosting company and web master out there will definitely recommend this method of web page redirection. The code “301” is interpreted as “moved permanently”.
For websites hosted in either dedicated server or a shared web hosting server, you use 301 redirects in redirecting a single html page or an entire website.
Here’s and example of redirecting a single page/html page:
Redirect 301 /oldpage.html http://www.example.com/newpage.html
For a whole website, you can use 301 redirect in this manner:
Redirect 301 / http://www.example.com/
Personally on my shared web hosted site, I only use the HTML redirect. But there are other use of the 301 redirect on a web sites.
Here are other use of it:
- Changed file extension
- Redirect web site with ‘www’ to not having one.
- vice versa of the previous example.
- Redirect example.com/index.php to example.com/
So next time you moved your web site content from one web hosting server provider to another or moving your site to a new domain name, you can definitely use the 301 redirect.
Don’t forget 301 redirecting is great if you want to move one directory to another or a directory to the root domain of your website. You can also use mod_rewrite and not have to physically move any files at all.
And the the htaccess file for canonical issues such as www or non www to prevent url bleeding