SEO Redirect or 301 Redirect
February 19th, 2008 | by Ankit |SEO redirect or 301 redirect is one of the best Search Engine Friendly method to redirect a webpage. It is easy to implement and it will preserve your rankings for that page. 301 redirect means “moved permanently”.
You can also use this tool Redirect Checker to check if your page is 301 redirect or not.
Here are some of the common of the common examples of 301 redirect you can use with your website:
Search Engine considers ankitrawat.com and www.ankitrawat.com both Different websites. So you have to redirect one of them to other so as to have a same PR.
This is not a new issue its already discussed lots of time like in 2005 Dan wrote a post in his blog example.com vs www.example.com.
Well here I’m Telling you the code you have to put into your .htacess file into the root folder of your control panel.
The code to redirect ankitrawat.com to www.ankitrawat.com would be as follows:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.ankitrawat\.com [NC]
RewriteRule ^(.*)$ http://www.ankitrawat.com/$1 [L,R=301]
Code to redirect www.ankitrawat.com to ankitrawat.com will be:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^ankitrawat\.com [NC]
RewriteRule ^(.*)$ http://ankitrawat.com/$1 [L,R=301]
Now last night I was browsing DP and there a guy asked he want to change his website url. (Domainname.com to Domainname.org) or we can say he wanted to move his domain without loosing search engine ranks… so here we go with the coding part…
301 code to Move your domain to www.ankitrawat.com:
RewriteEngine On
RewriteRule ^/(.*)$ http://www.ankitrawat.com/$1 [R=301,L]
You can also redirect sub-domains. Just add the below code into the .htaccess inside the root of your olddomain.com.
Code to redirect sub-domains of Your olddomain.com to ankitrawat.com:
RewriteEngine On
RewriteCond %{HTTP_HOST} (.*)\olddomain\.com
RewriteRule ^(.*) http://%1ankitrawat.com/$1 [R=301,L]
If you have moved some old page to a new page and want all visitors and search bots to redirect to your new page simply put any of the code into your old page :
301 PHP redirect Code to redirect old page to www.ankitrawat.com:
< ?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.ankitrawat.com" );
? >
301 JSP (Java Script) redirect code to redirect old page to www.ankitrawat.com:
<%
response.setStatus(301);
response.setHeader( "Location", "http://www.ankitrawat.com/" );
response.setHeader( "Connection", "close" );
%>
It is strongly recommended that you should contact all the website owners earlier linking your website or pages to link your new website or page. Right now Google is passing all the search ranking and Pagerank redirect under 301 code.
If you enjoyed this post, make sure you subscribe to my RSS feed!
|
If you like this post then please consider subscribing to my Full RSS Feed. You can also Subscribe By Email and have new posts sent directly to your inbox., You can now Subscribe My Feeds via SMS For Free, using Google's SMS Channel. |












By angilina on Mar 2, 2008
Thanks for this informative article
By Joe on Mar 19, 2008
Interesting. Any idea how one would accomplish this on a windows server?
By Fezzy on Mar 19, 2008
You can also use redirect plugins for Wordpress blogs , i use it on my own blog. Click my name to check it out.
Search Google for “Redirect Plugin Wordpress” and a download of the plugin comes up first.
By g1smd on May 30, 2008
There’s an error in the third example.
The leading slash is not available to the RewriteRule, nothing will ever match.
By Ankit on May 31, 2008
Can u tell me about which example u talking abt ?