How to Move Your WordPress Site from a Subdomain to the Root Domain Using cPanel

How to Move Your WordPress Site from a Subdomain to the Root Domain Using cPanel

If you’re thinking about moving your website from a subdomain to the root domain, you may need a guide which can explain a step by step process.

Most of the WordPress experts claim that a root domain has a better SEO score than a subdomain. Maybe that’s why people try to migrate their website to it.

When you run a forum or a support page, you may need to create a subdomain or a subdirectory, but at some point, you may get an idea to migrate to a root domain.

In this tutorial, you’re going to have a convenient method, which helps you understand the concept better. You may be thinking if any coding skills are required. Well, even a non-technical person can migrate a website from one location to another.

Assuming you have a good domain hosting package that includes cPanel, and supports WordPress, let’s get started!

What’s a Subdomain and a Root Domain

Before you proceed, let me clear the concept of having a root domain and its subdomain. Let’s say you have a website “yoursite.com,” and you have its subdomain, it’s “blog.yoursite.com.”

And now, you want to move blog.yoursite.com to yoursite.com.

Note: It’s easier than migrating a website from one host to another.

Here, you have the sameweb hosting, same database, but the location of the WordPress files changes. There are two different ways to accomplish such a task.

  • Backup and restore it in the public_html directory
  • Select all and move everything from a subdomain to the public_html directory.

I am going to show you the second method because uploading the backup can be hectic. And if you don’t have the fast internet, the upload process may stop.

Moving the file is easy because everything is available on the same server, you only need to change the location.

Start the Migrating Process

It’s always recommended to backup the WordPress site and the database for safety. If you break your website during migration, you can use the first method to restore it.

Follow the steps.

Step 1:

Login to your cPanel account and open the file manager

, which consists of all the WordPress installation files and folders.

How to Move Your WordPress Site from a Subdomain to the Root Domain Using cPanel

I hope you already know that even a subdomain folder is residing in the public_html directory.

Step 2:

So, you need to

open the public_html directory

 by navigating to the left-hand sidebar. When you open it, you can see the subdomain folder, open it.

How to Move Your WordPress Site from a Subdomain to the Root Domain Using cPanel

Step 3:

Now select all the files and folders. Right-click and choose “Move.”

How to Move Your WordPress Site from a Subdomain to the Root Domain Using cPanel

Step 4:

A popup appears to fill in the destination. Keep it public_html

because the WordPress installation should be in the root directory for a root domain.

How to Move Your WordPress Site from a Subdomain to the Root Domain Using cPanel

Click on the Move File(s) button, and the process starts. Depending on the size of your website, the process will end. It may take a few minutes if you have a massive site.

After the migration of the data, you need to update the website URL. From blog.yoursite.com to yoursite.com.

Step 5:

You can either do it by editing the database or simply by the wp-config.php file you just moved to the public_html directory.

How to Move Your WordPress Site from a Subdomain to the Root Domain Using cPanel

define( 'WP_HOME', 'http://yoursite.com' );
define( 'WP_SITEURL', 'http://yoursite.com' );

Note: If you use an SSL certificate, don’t forget to use HTTPS instead of HTTP.

How to Redirect the Traffic from Your Subdomain to the Root Domain

As you already know, the search engine treats a subdomain as a different identity than a root domain, so you need to add a redirect to make everyone know about the migration.

How to Move Your WordPress Site from a Subdomain to the Root Domain Using cPanel

For which, you can either use a plugin or add a redirect code in the .htaccess file.

<IfModule mod_rewrite.c>
RewriteEngineOn
RewriteBase /
RewriteCond%{HTTP_HOST} ^subdomain.example.com$ [NC]
RewriteRule ^(.*)$ "http://rootdomain.com/$1" [R=301,L]
</IfModule>

Note: Don’t forget to replace the subdomain and the domain name.

A 301 is a permanent redirect, which means whenever people open the subdomain, they get redirected to the root domain.

Even Google bots see the root domain.

It’s possible that you see some broken interlinks. The solution is to use a plugin. Install and activate theVelvet Blues Update URLs plugin and fill in your subdomain and root domain.

Conclusion

For a better SEO score, most of the people might decide to migrate their website from a subdomain to its root domain. Well, as you can see, there is nothing complicated.

In fact, as compared to the web hosting migration, there is less number of steps in the process. I hope you can easily migrate a subdomain to a root domain.

Check out these top 3 WordPress hosting services:

A2 Hosting
£1.49 /mo
Starting price
Visit A2 Hosting
Rating based on expert review
  • User Friendly
    4.5
  • Support
    4.0
  • Features
    4.5
  • Reliability
    4.8
  • Pricing
    4.0
IONOS
£0.76 /mo
Starting price
Visit IONOS
Rating based on expert review
  • User Friendly
    4.5
  • Support
    4.0
  • Features
    4.5
  • Reliability
    4.5
  • Pricing
    4.3
Webdock
£0.80 /mo
Starting price
Visit Webdock
Rating based on expert review
  • User Friendly
    3.8
  • Support
    4.5
  • Features
    4.5
  • Reliability
    4.3
  • Pricing
    4.3
HostAdvice.com provides professional web hosting reviews fully independent of any other entity. Our reviews are unbiased, honest, and apply the same evaluation standards to all those reviewed. While monetary compensation is received from a few of the companies listed on this site, compensation of services and products have no influence on the direction or conclusions of our reviews. Nor does the compensation influence our rankings for certain host companies. This compensation covers account purchasing costs, testing costs and royalties paid to reviewers.
Click to go to the top of the page
Go To Top