301 redirect is the most efficient and search engine friendly method for webpage redirection. Below are a few methods to implement URL redirection.
IIS 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://new-url.com");
?>
ASP Redirect
<%@ Language=VBScript %>
<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", "http://new-url.com"
%>
ASP .NET Redirection
<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location", "http://new-url.com");
}
</script>
JSP (Java) Redirection
<%
response.setStatus(301);
response.setHeader("Location", "http://new-url.com");
response.setHeader("Connection", "close");
%>
CGI Perl Redirection
$q = new CGI;
print $q->redirect("http://new-url.com");
Ruby on Rails Redirect
def old_action
headers["Status"] = "301 Moved Permanently"
redirect_to "http://new-url.com"
end
Linux htaccess Redirect
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://new-url.com/$1 [R=301,L]
IIS Redirect
- In Internet Services Manager, right click on the domain (or file or folder) you wish to redirect
- Select "a redirection to a URL"
- Enter the redirection address
- Check "The exact URL entered above" and "A permanent redirection for this resource"
- Click on "Apply"
<.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://new-url.com");
?>
ASP Redirect
<%@ Language=VBScript %>
<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", "http://new-url.com"
%>
ASP .NET Redirection
<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location", "http://new-url.com");
}
</script>
JSP (Java) Redirection
<%
response.setStatus(301);
response.setHeader("Location", "http://new-url.com");
response.setHeader("Connection", "close");
%>
CGI Perl Redirection
$q = new CGI;
print $q->redirect("http://new-url.com");
Ruby on Rails Redirect
def old_action
headers["Status"] = "301 Moved Permanently"
redirect_to "http://new-url.com"
end
Linux htaccess Redirect
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://new-url.com/$1 [R=301,L]