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)
Options +FollowSymLinks
RewriteEngine on
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.
302 Found:
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.
Very easy to understand thanks for such a nice article
I personally feel this issue is only related to changing the redirect to a 301 (which the patch does fine), the module uses header() in quite a few places and changing to drupal_set_header() should be a separat issue
Great post. I was checking constantly this blog and I am impressed! Very helpful information specifically the last part 🙂 I care for such information a lot. I was looking for this certain information for a very long time. Thank you and good luck.
Thanks For Such Detailed information.
Nice Information that is very helpful for everyone, thank you for sharing the article.