Support Centre

Configuring a 301 Redirect

4*4*4*4*4*

Article

Redirecting with a 301 redirect

For many reasons, including search engine optimisation, it is important to add 301 redirects for any old pages on your site which no longer exist. There are many ways that you can do this, dependent on the hosting platform that your site operates from, as well as your own preference on what you are comfortable using. There are a few examples below which will allow you to create 301 redirects no matter which platform you are working from.

Example for Apache and .htaccess

RedirectMatch 301 (.*)\.htm$ http://www.example.com$1.php

Example for PHP Redirect

<?php    
Header
"HTTP/1.1 301 Moved Permanently" );     
Header"Location: http://www.new-url.com" );     
?>

Example for ASP Redirect

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

Example for 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.example.com");       
}       
</script>

Rate This Article

How useful was this article?

Not useful A little useful Useful Very useful Everything I needed