Tuesday, August 18, 2009

How to Redirect a Web Page

Redirecting is one of the technique to move from one location(site or web page ) to another. we have several other way to redirect the pages we can also use IIS or by programetically we can do that .

ways to Redirecting
1. IIS Redirect
2. ASP redirect
3. ASP.NET redirect
4. 301 Redirect
5. JAVA redirect
6. PHP redirect
7. CGI redirect
8. htaccess Redirect


1. IIS Redirect

- while redirecting with IIS its very easy to do, open the IIS , Select proper folder you want to redirect
- select radio buttion on "Redirection to URL "
- enter page name
- select "The exact url entered above" and "A permanent redirection for this resource"
- click apply


2. ASP redirect
on Asp redirect its very simple need to mention the page name

<%
response.redirect "Redirectpagename.asp"
%>


3.ASP.NET redirect

private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = "301 Redirect";
Response.AddHeader("Location","http://www.enter-new-url-here.com");
}


4. 301 Redirect

301 Redirect is one of the Best and Friendly method for webpage Redirection. it will not affect your webpageranking also,if you want to move page or change page around then its a safe and secure method to do .
You can also test your redirection with "Search Engine Friendly Redirect Checker"
there are lot of free tools are availble on net

5. JAVA redirect


<%
response.setStatus(301);
response.setHeader( "Location", "http://www.new-location-come.com/" );
response.setHeader( "Connection", "close" );
%>



6. PHP redirect


<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.new-location-come-here.com" );
?>



7. CGI redirect


$urlvar = new CGI;
print $urlvar->redirect("http://www.new-location-come-here.com/");



8. htaccess Redirect

.htaccess is one of the way also you can redirect your webpage or old domain name to new domain name also. we have to place the .htaccess file on Root directly of your old website.

RewriteRule (.*) http://www.newdomaainnamecomeshere.com/$1 [R=301,L]

but there is some limitation this .htaccess method will only worrks on Linux server.

No comments:

Post a Comment