Just to jog your memory quickly – there are 2 types of redirects. The first is a 301 Permanent redirect and the second a 302 Temporary redirect. Although both do the job of redirecting the old URL to its new location, redirects can cause some logistical issues for your SEO campaign.
The 302 Temporary Redirect acts as an indicator to tell the server (or search engine spider) that the redirect is only a temporary one, and that the old URL is still more relevant than the current (temporary) destination.
In the case of a 301 Permanent redirect, the server (or spider) takes note that the old page is no longer relevant and that all the relevance from the old URL should be carried over to the new destination.
Relevance, as we know, is important to search engines and without using a 301 redirect you will not benefit from any of the old domain’s history or inbound links. In one case a new client was complaining about the rankings on his new site. We then discovered that none of his pages on his new domain showed up on Google, only the old domain’s results were showing. We did a bit of investigating and discovered that he used the incorrect 302 temporary redirect which told Google to not worry about the new domain and rather keep the old domain information.
So now that you we know why we should change them to 301’s, but how do we do this?
In internet services manager, right click on the file or folder you wish to redirect
Select the radio titled "a redirection to a URL".
Enter the redirection page
Check "The exact url entered above" and the "A permanent redirection for this resource"
Click on 'Apply'
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/");
Ruby on Rails Redirect
def old_action
headers["Status"] = "301 Moved Permanently"
redirect_to "http://www.new-url.com/"
end
Redirect Old domain to New domain (htaccess redirect):
Create an .htaccess file with the below code, it will ensure that all your directories and pages of your old domain will get correctly redirected to your new domain.
The .htaccess file needs to be placed in the root directory of your old website (i.e. the same directory where your index file is placed).
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]
Please REPLACE www.newdomain.com in the above code with your actual domain name.
In addition to the redirect I would suggest that you contact every backlinking site to modify their backlink to point to your new website.
Note* This .htaccess method of redirection works ONLY on Linux servers having the Apache Mod-Rewrite moduled enabled.
Redirect to www (htaccess redirect):
Create a .htaccess file with the below code, it will ensure that all requests coming in to domain.com will get redirected to www.domain.com
The .htaccess file needs to be placed in the root directory of your old website (i.e the same directory where your index file is placed).
Options +FollowSymlinks
RewriteEngine on
rewritecond %
Unknown macro: {http_host}
^domain.com [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]
Please REPLACE domain.com and www.newdomain.com with your actual domain name.
Note* This .htaccess method of redirection works ONLY on Linux servers having the Apache Mod-Rewrite moduled enabled.
After you have changed your redirects, test to see if they are SEO friendly by typing the old URL below:







Great post Werner!
Posted by Janine on 2007/11/28