Migrating domain content using .htaccess:

Ok here’s the problem:

You have an old website that can be found under olddomain.com and you have a new website that is accessible under newdomain.com.

Copying the content of the old website to the new website is the first step – but what comes after that?

Doing a “301 moved permanently” redirect from the old domain to the new domain – offers several advantages, and it’s not tough to do.

  1. Users will automatically be redirected to the new domain – you do not have to inform them.
  2. Search engines will be redirected to the new domain and all related information will be moved to the new domain (but this might take some time).
  3. Google’s PageRank ™ will be transfered to the new domain, as well as other internal information that is being used to set the position of pages in the search engine result pages (serp’s) – like TrustRank .

So here the solution:

Create a 301 redirect for all http requests that are going to the old domain.

  • Example 1 – Redirect from olddomain.com to www.newdomain.com:

RewriteEngine On
RewriteCond %{HTTP_HOST} !newdomain.com$ [NC]
RewriteRule ^(.*)$ http://www.newdomain.com/$1 [L,R=301]

This is useful when you use www.newdomain.com as your new domain name (see also this article about redirecting www and non-www domains). If not – use the code of example 2.

  • Example 2 – Redirect from olddomain.com to newdomain.com:

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !newdomain.com$ [NC]
RewriteRule ^(.*)$ http://newdomain.com/$1 [L,R=301]

See, told you it was easy icon wink Migrating domain content using .htaccess:

This entry was posted in SEO News & Tips and tagged , , , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>