Monday, January 11, 2010

How to redirect your Website


5 Tips to redirect your website:

1. Don't use Client Side Redirects:

Client Side Redirects can be meta-refresh or JavaScript. In general, it is much better to use server side redirects because most Search Engines may not understand Meta Refresh redirect and consider pages with Javascript redirect as spam pages.

2. Use Server Side Redirects:

301 Redirects let Search Engines know that your website has "moved permanently" to the new address. (If Search Engines are not able to follow the redirect they would think that your website has No Contents.)

3. Make sure that the server can execute a server side script.

4. Add 301 Server scripts to the landing page of the website

For example, I redirected www.globalmarketingtour.com to www.gmt2011.com by creating index.php in the root folder of www.globalmarketingtour.com and adding the following script to it:

<?

header("HTTP/1.1 301 Moved Permanently");

header("Location: http://www.gmt2011.com");

exit();

?>


5. Use Search Engine Friendly Redirect Checker to test your redirection




Search Engine Friendly Redirect Check

Enter the URL whose Redirect you want to check




301 Redirects

ColdFusion Redirect



<.cfheader statuscode="301" statustext="Moved permanently">

<.cfheader name="Location" value="http://www.new-url.com">


PHP Redirect


<?

Header( "HTTP/1.1 301 Moved Permanently" );

Header( "Location: http://www.new-url.com" );

?>


ASP Redirect



<%@ Language=VBScript %>

<%

Response.Status="301 Moved Permanently"

Response.AddHeader "Location","http://www.new-url.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.new-url.com");

}

</script>

JSP (Java) Redirect



<%

response.setStatus(301);

response.setHeader( "Location", "http://www.new-url.com/" );

response.setHeader( "Connection", "close" );

%>


CGI PERL Redirect



$q = new CGI;

print $q->redirect("http://www.new-url.com/");