Search Support
contact us

Let Us Make it Easy for You. Call 1-877-898-3290 for MyTime Support™. Learn More

301 Redirect

Article Rating: 1 / 5 Votes: 62

A 301 redirect is the best search engine friendly method for Web page redirection. Redirects take a visitor from one URL to another. Although redirects may serve many purposes, the main SEO purpose is to serve one copy of each page to the search engines. The code "301" is interpreted as "moved permanently." Having multiple URLs that all go to the same website may be viewed by Google® and other search engines as different websites, which could create duplicate content penalties. But by making one URL dominate over the other, this will help reduce the possibility of a duplicate content penalty.  

For technical reasons, you should only implement a redirect when no CMS is available and when your website is running on a Unix®/Apache® server.  Should you attempt to modify the necessary file when a CMS is present, there is a risk that your entire site will break. As our Customer Service and Technical Support teams do not provide support for creating this type of custom code, we are providing this information for your reference.

Below are a Couple of methods to implement URL Redirection

ColdFusion Redirect

<.cfheader statuscode="301" statustext="Moved permanently">
<.cfheader name="Location" value="http://www.newdomain.com">

PHP Redirect

<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.newdomain.com" );
?>

ASP Redirect

<%@ Language=VBScript %>
<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location","http://www.newdomain.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.newdomain.com");
}
</script>

JSP (Java) Redirect

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

CGI PERL Redirect

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

Redirect OLD Domain to NEW Domain (htaccess redirect)

 

Create a .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 %{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.

How to Redirect HTML

Please refer to section titled 'How to Redirect with htaccess', if your site is hosted on a Unix Server