How To Use A 301 Redirect!

Sep 19, 2011 | 4,514 views | by Navneet Kaushal
VN:F [1.9.20_1166]
Rating: 5.0/5 (6 votes cast)

301 redirect is the answer to the frantic prayers sent by webmasters, when they were faced with the task of redirecting traffic from an old web page to a new one. 301 redirect is the not only the easiest, most efficient method for web page redirection, but it also preserves your search engine rankings for the page in question. The engines interpret the code "301" as "moved permanently". According to Google, "If you need to change the URL of a page as it is shown in search engine results, we recommended that you use a server-side 301 redirect instead."

The User and Engines Experience with 301 Redirects

In most cases, the users don't notice the URL redirecting to a new one. If they get the content they were looking for, they will not be affected by the redirect. The search engines follow the redirect 301 on a URL and de-index the old URL. Also, they pass the existing links to the new URL (not 100% of it though). Google says that a 301 can pass anchor text, but there are no guarantees. The engines also remove the old page from their index so that the users don't get to them, and have poor search experience.

Here is what Google has to say about 301 Redirects

The Best Times To Use A 301 Redirect

When You Are Moving Sites- this means that if you are changing your URLs to a new structure or shifting the site to a new location, then you must use 301 Redirect. If the move is due to a new design, the you don't want the engines to index the old pages. Read the Google guidelines on 301 redirects and their usage in the case of moving sites.

When You Have Expired Content- If you have a bunch of product descriptions/outdated news items or old terms and conditions that are useless for the users, then you must use a 301 Redirect. But before doing that make sure that you don't get any traffic from that content. In case of the traffic, redirect that page to a similar page on your site, so that you don't lose the traffic. Or is there a chance of the content becoming useful again ( if a product is revived in the case of e-commerce sites. ) Get these issues out of the way before you employ a 301 redirect.

When You Have Multiple Versions Of The Homepage- If you have a or a or a then they should 301 to the correct URL-

However, if multiple versions were used to show users who are logged in or have cookies dropped, then 301 is not recommended.

How to Set Up a 301 Redirect
If you have a definite requirement, then you can use several methods to set up a 301 redirect.

1.) htaccess 301 Redirection

For this method, in the root directory of your old website, place the .htaccess file. See the example below, where traffic from an old domain is being redirected to a new domain.

Options +FollowSymLinks

RewriteEngine on

RewriteRule (.*)$1 [R=301,L]

Replace the in the above code with your actual domain name. This is the easiest and most prefered method used for 301 web site redirection.

2.) PHP 301 Redirectio

For this method, you would place this code in a file at the old location.
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location:" );

Replace the in the above code with your actual domain name. Like with any code, you will test this.

3.) IIS 301 Redirection

  • Go to Internet Services Manager- then right click on the file or folder you wish to redirect
  • Click the radio button titled "a redirection to a URL".
  • Key in the redirection web page
  • Check "The exact URL entered above" and the "A permanent redirection for this resource"
  • Click on 'Apply'

That is all there is to it.

4.) ColdFusion Redirect

<.cfheader statuscode="301" statustext="Moved permanently">
<.cfheader name="Location" value="">

5.) ASP Redirect

<%@ Language=VBScript %>
Response.Status="301 Moved Permanently"
Response.AddHeader "Location",""

6.) ASP .NET Redirect

<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
Response.Status = "301 Moved Permanently";

7.) JSP (Java) Redirect

response.setHeader( "Location", "" );
response.setHeader( "Connection", "close" );

8.) A Word Of Caution

Make sure that you do not get mixed between a 301 redirect instead. Remember that a 302 is meant to be used when content is temporally moved, 301 is for permanent redirects. Also make sure that you do not redirect all of the pages to a single URL, usually the homepage. This makes Google think that you are trying to consolidate all the link juice from multiple pages into one page. This can lead to a penalty.

Be careful and you will ensure a smooth 301 redirect. More on the same here

How To Use A 301 Redirect!, 5.0 out of 5 based on 6 ratings
4.thumbnail How To Use A 301 Redirect!

Navneet Kaushal

Navneet Kaushal is the founder and CEO of PageTraffic, an SEO Agency in India with offices in Chicago, Mumbai and London. A leading search strategist, Navneet helps clients maintain an edge in search engines and the online media. Navneet's expertise has established PageTraffic as one of the most awarded and successful search marketing agencies.
4.thumbnail How To Use A 301 Redirect!
4.thumbnail How To Use A 301 Redirect!