How to Permanent Redirect a Web Page
Sometimes we’ve just redesigned some pages of our web site. The pages have high search engine rankings that we don’t want to lose. How can we safely redirect web site traffic from our old pages to the new pages without losing our rankings?
We should set up a permanent redirect (technically called a “301 redirect”) between these sites. Once we do that, we will get full search engine credit for our work on these sites.
301 redirect is useful too for search engines which may think, for example, www.office-it.org and office-it.org are two different sites. Let say, www.office-it.org seems to have 5 inbound links whereas office-it.org has 6 inbound links. By correctly configuring a permanent 301 redirect, the search rankings might improve as all inbound links are correctly counted for the website.
What is 301 redirect?
301 redirect is the best method to preserve our current search engine rankings when redirecting web pages or a web site. The code “301″ is interpreted as “moved permanently”. If we have to change file names or move pages around, it’s the safest option.
Below are a couple of methods to implement URL Redirection.
IIS Redirect
1. In internet services manager, right click on the file or folder we wish to redirect
2. Select the radio titled “a redirection to a URL”
3. Enter the redirection page
4. Check “The exact url entered above” and the “A permanent redirection for this resource”
5. Click on ‘Apply’
ColdFusion Redirect
<.cfheader statuscode="301" statustext="Moved permanently">
<.cfheader name="Location" value="http://www.new-url.com">
PHP Redirect
Warning: Cannot modify header information - headers already sent by (output started at /home/icreativem/domains/office-it.org/public_html/wp-content/plugins/all-in-one-seo-pack/aioseop.class.php:221) in /home/icreativem/domains/office-it.org/public_html/wp-content/plugins/exec-php/includes/runtime.php(42) : eval()'d code on line 29
Warning: Cannot modify header information - headers already sent by (output started at /home/icreativem/domains/office-it.org/public_html/wp-content/plugins/all-in-one-seo-pack/aioseop.class.php:221) in /home/icreativem/domains/office-it.org/public_html/wp-content/plugins/exec-php/includes/runtime.php(42) : eval()'d code on line 30
ASP Redirect
<%@ Language=VBScript %>
<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location","http://www.new-url.com/"
%>
ASP .NET Redirect
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 a .htaccess file with the below code, it will ensure that all directories and pages of our old domain will get correctly redirected to our new domain. The .htaccess file needs to be placed in the root directory of our old website (i.e the same directory where our 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 our actual domain name.
In addition to the redirect we 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 our old website (i.e the same directory where our 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 our actual domain name.
Note* This .htaccess method of redirection works ONLY on Linux servers having the Apache Mod-Rewrite moduled enabled.
Free Tool to Test
Search Engine Friendly Redirect Checker is the free web services to test redirection.
Popularity: 6% [?]
