Revenue Robot Header ad 07 -->

How to do a 301 redirect for a website

February 11th, 2009   | Filed in: Blogging

I’ve read alot of sites saying that the 301 redirect could be called the most efficient and search engine friendly method for webpage redirection. The code “301″ is interpreted as “moved permanently“. If you recall a bit back I did a post on How to Redirect a Website with PHP which his you lead a link to a page on your site by using PHP. Below are a bunch of useful ways to redirect your site “permanently” in a way.

PHP Redirect

<?
Header( “HTTP/1.1 301 Moved Permanently” );
Header( “Location: http://www.yourdomain.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.yourdomain.com”);
}
</script>

JSP (Java) Redirect

<%
response.setStatus(301);
response.setHeader( “Location”, “http://www.yourdomain.com/” );
response.setHeader( “Connection”, “close” );
%>

ColdFusion Redirect

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

ASP Redirect

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

CGI PERL Redirect

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

If you know of any other ways to redirect a page via the 301 method please feel free to leave it as a comment.



RELATED POSTS

Subscribe Now!

SHARE THIS POST WITH FRIENDS

POST A COMMENT

Want a personal icon with your comments? Sign up for a Free Gravatar Now!





Topic Tags: , , , , ,