Last updated: 12/7/2009
SEO friendly way to redirect a website or webpage
SEO friendly way to redirect a website or webpage
If you need to move a webpage or website and don't want to lose your page ranking, then use a 301 redirect. It is extermely easy to implement a 301 redirect and will help you retain your Search ranking even though the URL has changed.
Below are examples in different languages
ASP
<%@ Language=VBScript %>
<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location","http://www.your_new_url.com/"
%>
ASP .NET
<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location","http://www.your_new_url.com");
}
</script>
JSP (Java)
<%
response.setStatus(301);
response.setHeader( "Location", "http://www.your_new_url.com/" );
response.setHeader( "Connection", "close" );
%>
ColdFusion
<.cfheader statuscode="301" statustext="Moved permanently">
<.cfheader name="Location" value="http://www.your_new_url.com">
PHP
<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.your_new_url.com" );
?>