301 redirect is one of the fundamental coding standards for both SEO and good coding practices. A 301 redirect tells the visitor that the page they are trying to access has been “moved permanently” and directs the visitor to the proper place to find their content. From an SEO perspective, you are able to keep “most” of your authority from the original page. From a usability stand point, you are able to display a user friendly URL and also fix external linking issues. You should always monitor your 404 errors in Google Webmaster Tools and apply the proper 301 redirect as needed in order to fix broken links from external sources. The Live HTTP Headers add-on from FireFox is a great way to check that your redirects are working properly.

Here are some examples on how to execute a 301 URL Redirection


PHP Redirect | .htaccess Redirect | ASP Redirect | .NET Redirect | CGI Redirect | PERL Redirect | IIS Redirect | JSP Redirect | Java Redirect | Cold Fusion Redirect | Ruby on Rails Redirect



PHP Redirect

Header( “HTTP/1.1 301 Moved Permanently” );
Header( “Location: http://www.TheNewURL.com” );


.htaccess Redirect

Redirect 301 /old-page.html http://www.domain.com/new-page.html


ASP Redirect

<%@ Language=VBScript %>
Response.Status=”301 Moved Permanently”
Response.AddHeader “Location”,”http://www.TheNewURL.com/”


.NET Redirect

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


CGI Redirect / PERL Redirect

$q = new CGI;
print $q->redirect(“http://www.TheNewURL.com/”);


IIS Redirect

  • In internet services manager, right click on the file/folder for the redirect
  • Select the radio button “a redirection to a URL”.
  • Enter the redirection URL
  • Check “The exact url entered above” and the “A permanent redirection for this resource”
  • Click on ‘Apply’


JSP Redirect / Java Redirect

response.setHeader( “Location”, “http://www.TheNewURL.com” );
response.setHeader( “Connection”, “close” );


Cold Fusion Redirect

<.cfheader statuscode=”301″ statustext=”Moved permanently”>
<.cfheader name=”Location” value=”http://www.TheNewURL.com”>


Ruby on Rails Redirect

def old_action
headers[“Status”] = “301 Moved Permanently”
redirect_to “http://www.TheNewURL.com”