Show All Articles

How to 301 Redirect a Web Page - 301 Redirect Methods

Mike S.  |   16-Sep-2009  |   SEO  |   1102

What is 301 Redirection?

301 redirect is the most efficient and search engine friendly (SEO) method for webpage redirection. One of the biggest advantage is that it also pass on the PageRank value and hence preserves the current search engine rankings for that particular page. It is the best and safest way in case of renaming or moving files to other location. The code "301" is normally interpreted as "moved permanently".

Use this free 301 URL Redirection Checker tool to check the redirection of a webpage.

Benefits of Redirection

A web page may be redirected for several reasons:

  • A web site might need to change its domain name.
  • An author might move his or her pages to a new domain.
  • Two web sites might merge.

With URL redirects, incoming links to an outdated URL can be sent to the correct location. These links might be from other sites that have not realized that there is a change or from bookmarks/favorites that users have saved in their browsers.

Different Methods to Implement URL Redirection

Following are some common ways to do 301 redirection in different languages. The example are taken from internet, so make sure if all the things work well before finally implementing them.

Redirect through .htaccess file
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example\.com
RewriteRule ^(.*)$ http://www.example.com/$1 [R=permanent,L]
-or-
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

PHP Redirect
<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.newdomain.com" );
?>

CGI PERL Redirect
$q = new CGI;
print $q->redirect("http://www.newdomain.com/");

Ruby on Rails Redirect
def old_action
headers["Status"] = "301 Moved Permanently"
redirect_to "http://www.newdomain.com/"
end

Java Redirect
<%
response.setStatus(301);
response.setHeader( "Location", "http://www.newdomain.com/" );
response.setHeader( "Connection", "close" );
%>

ColdFusion Redirect
<.cfheader statuscode="301" statustext="Moved permanently">
<.cfheader name="Location" value="http://www.newdomain.com">

ASP Redirect
<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location","http://www.newdomain.com/"
%>

ASP .NET Redirect
<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location","http://www.newdomain.com");
}
</script>

HTML Redirect (Meta Redirect)
To send someone to a new web page or site put this in the head section of your document:
<meta http-equiv="refresh" content="5"; url=http://newdomain.com/">
Here content="5" means the time (e.g. 5) in second the browser should wait before redirecting to new location.

To check redirection of a web page, use this tool : 301 URL Redirection Checker

Mike S. is an internet junkie. He is fond of discovering interesting things online and like to share with others. When he is not working, he can be found twittering.

Share:RedditDel.ici.ousFacebookStumbleUponDigg It!TwitterTechnoratiDiigoDZone It!MySpaceMixx
Rate this article:
Active StarActive StarActive StarActive StarInactive Star
(4.3 rating from 4 votes)
Check out our large collection of
Free Webmaster Tools

(For beginners & Advanced users)

0 Comments

Leave a Reply


Enable images to see captcha text
Enter code:
  

Copyright © 2010 WebToolHub. All rights reserved.