HTTP URL Permanent Redirect

By Akbar

Recently, I migrated my website from the free domain syedgakbar.co.cc to my new domain www.syedgakbar.com. Once the migration process was done, I looked into options to redirect all the new traffic point to old site to my new site without breaking the links:

As I was hoping, it was just a one line change in the “.htaccess” file (this is supported in the Apache). Here is the exact code:

RewriteEngine On
RewriteRule (.*) http://www.syedgakbar.com/$1 [R=301,L]

RewriteEngine On

RewriteRule (.*) http://www.syedgakbar.com/$1 [R=301,L]

For those who are not familiar with RewriteRule syntax, the above line is very simple. It just tells the web-server to redirect all the requests (of all pages) to the new domain. The R=301 in the option tell the web-server that it’s a permanent redirect. This helps the search engine robots update their references too. This in most of the cases, help you retain your previous search engine ranking. This trick works for both the robots (search engine crawlers) and the persons viewing the site, and it’s seamless.

If you are running using Microsft IIS, then you can use a free ISAPI Rewrite utility:
http://www.isapirewrite.com/

Hope this helps.

RewriteEngine OnRewriteRule (.*) http://www.syedgakbar.com/$1 [R=301,L]

Tags: ,