301 Redirect Subdomain To Main(Addon) Domain And Preserve Link juice

I decided to write this post to help a friend, who formerly, his blog was install in a subdomain but later, he bought a new domain, set it as an addon domain and change the WordPress blog URL to the new domain.
In order to prevent the wrath of Google(they frown and penalise website with duplicate content), and also preserve the pagerank and other juice associated with the subdomain the blog was running on, we need to set a 301 permanent redirection to the new domain name.
Setting a 301 redirect to the addon or new domain will redirect users to the post or content in the new domain when visiting with the old subdomain URL.

Case Sturdy

Let the old subdomain be sub.domain.com and the newly bought domain be yoursite.com
Also let’s assume that a post or content in the blog when it was in a subdomain to be http://sub.domain.com/post.
After implementing a 301 permanent redirect, a user visiting the blog via http://sub.domain.com/post will be redirected to http://yoursite.com/post

How To Setup A 301 permanent redirect From A Subdomain To A New (Addon)Domain

  1. Using either a software or web base FTP client such as filezilla or Net2ftp.com, Navigate to your addon domain or subdomain directory (they have same directory path), which is usually public_html/addon_domain_name when created with cPanel and other server CP.
  2. Edit the .htaccess file, and add the below code in the last line
    
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^sub.domain.com$ [NC]
    RewriteRule (.*) http://www.yoursite.com/$1 [R=301,L]
    
    </IfModule>
    

    Note: Change sub.domain.com and yoursite.com to your own subdomain and the new (addon)domain.
    If you are viewing this blog on a low-end mobile phone, eliminate any “[ph p]” and [/ php] in the code above.

  3. Test and see if the subdomain is now redirecting to the new domain.
  4. Resubmit your sitemap with the domain to Google webmaster tool.
  5. As time pass, the subdomain will gradually be removed from Google and other major search engine index.
Don’t miss out!
Subscribe to My Newsletter
Invalid email address