Print

How to 301 Redirect your Website

User Rating: / 46
PoorBest 

 

Website owners who want to move to a new domain or change link traffic need to take advantage of redirection. Redirection means the user is sent to a different page when accessing a URL. When a new domain is created or the internal web page names are changed, users receive a 404 error message unless redirection is implemented. A redirection can be used for a homepage or other web pages within the internal structure of the domain.

The importance of a 301 redirect is in search engine indexing. A 301 redirect transfers PageRank and content for search engines. This is more beneficial than any other type of redirect, because other types cause Google to detect duplicate content. Duplicate content hurts a website’s rank in Google, so a 301 redirect facilitates a website move or redesign without losing traffic.

What is a 301 Redirect?

A 301 redirect transfers traffic from one URL to another. It is distinct from a 302 redirect. The difference between the two types is how search engines cache the results. When you use a 301 redirect, the original page is not loaded or indexed by search engines. The search engine bots are transferred to the new URL without ever seeing the original content. A search engine bot that reaches a 302 redirect will view the old page. The old page’s content is indexed, and then the bot is transferred to the second page. This causes search engines to see two pages with the same content, which harms Google rank.

Redirecting in Internet Information Service (IIS)

IIS is a website server for Microsoft hosting. If you use .NET (C# or VB.NET) programming for your website, then you probably have an IIS server. IIS 301 redirection is accomplished in the server settings or in the website code.

To use a 301 redirect in the IIS settings, right-click the folder you want to redirect. In the window that opens, select “A redirection to a URL.” Enter a URL in the text box. Check the boxes labeled “The exact URL entered above” and “A permanent redirection for this resource.” Implementing this configuration transfers all traffic that hits the folder to the URL indicated in the settings.

To use a 301 redirect in a web page, the following code implements the redirection without setting any server configurations. Place this code in the destination file for your web pages.

private void Page_Load(object sender, System.EventArgs e)

{

Response.Status = "301 Moved Permanently";

Response.AddHeader("Location","your_new_URL.com");

}

Apache Server 301 Redirects

Apache servers are used for websites programmed in PHP. Apache 301 redirection is implemented using a file named “.htaccess.” This file has no name except for the extension, so it’s at the top of your file list when you browse the root directory. The .htaccess file controls redirects using code. Below is the code used to redirect pages on an Apache server:

Options +FollowSymlinks

RewriteEngine on

rewritecond %{http_host} ^old_domain.com [nc]

rewriterule ^(.*)$ new_domain.com/$1 [r=301,nc]

There is one condition before this type of redirection will work. If you are on a hosted environment, the host service needs to give you “mod-rewrite” access. Some host services automatically give this type of access to customers, so check with your provider.

Using 301 redirects, you can pass PageRank and traffic to the new domain or web page. Implement this type of redirection to preserve search engine rank and avoid duplication issues in the index.