URL redirection, also called URL forwarding, domain redirection and domain forwarding, is a technique on the web to automatically take the Internet user to another web page address without him/her clicking on anything. The most commonly used redirects are 301, 302 and 307. These numbers refer to the HTTP Status Code returned by the server for a given URL. Here I have discussed about the 301 and 302 redirects and how search engines treat them.
301 Permanent Redirect:
A 301 redirect tells the search engine that the page has moved permanently to the new URL. All three major search engines handle 301 redirects the same, that is to say they ignore the original URL and instead index the destination URL. For example, www.domain1.com uses a 301 redirect to www.domain2.com and Google, MSN and Yahoo all return the result www.domain2.com when searching for the terms related to www.domain1.com.
When to Use 301
301 redirects can be very powerful when you redesign your site and the URLs change, move to a different domain, acquire a new domain, or implement a URL rewrite. In most cases, this is the type of redirect you want to use because you know exactly how the search engines will respond. 301 redirection is also done for redirecting non-www version of the website to www version of the website in order to avoid canonical issues.
301 Redirection Code for redirecting to a new domain
Create a .htaccess file with the below code, it will ensure that all your directories and pages of your old domain will get correctly redirected to your new domain.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)
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]
Please REPLACE www.newdomain.com in the above code with your actual domain name. And the above code will be applicable only for Apache servers and not for Linux Servers. And finally make a check with the Search engine friendly redirection checker tool inorder to ensure whether your redirection works fine.
A 302 redirect tells the search engine that the move is only temporary, and you may decide to show content at the original location in the future without a redirect. 302 is treated as page hijacking technique. A page hijack is a technique exploiting the way search engines interpret certain commands that a web server can send to a visitor. In essence, it allows a hijacking website to replace pages belonging to target websites in the Search Engine Results Pages. And the major search engines treat 302 differently.
Google will index the original URL and not the destination URL and displays the original URL in search results. Live treats 302 redirects exactly how it treats 301 redirects, it will always ignore the original URL and instead index the destination URL. Yahoo treats 302 same as Live. And this type of redirection is not recommended as it is not search engine friendly.
Disclaimer: The post is completely based on individual thoughts and SEO Services Group bears no responsibilities for the thoughts reflected in the post.