How to Safely Move WordPress Site To Root Domain (Step-by-Step Guide)

Jul 20, 2020

How to Safely Move WordPress Site To Root Domain (Step-by-Step Guide)

Jul 20, 2020

Do you have a WordPress subdomain that you want to convert to your main domain? Do you want to clean up your WordPress directory and move everything to your root folder?

Moving your WordPress site around is risky business. The process is technical and has the potential to break your website.

But don’t worry. There are safe ways to move your site to your root folder without affecting your website’s functioning. In this guide, we’ll show you exactly how to move your WordPress file from a subdomain or subdirectory to the root folder.

TL;DR – Moving your WordPress files from a subfolder to the root directory carries a lot of risk. You can eliminate this risk and move your site safely by using the BlogVault Migration Plugin. All it takes is a simple three-step process that removes the technical part. Your site will be moved to the root directory in a few minutes – safely and efficiently.

Moving WordPress From Subfolder Or Subdomain To Root Directory

While working with WordPress for over a decade, we’ve received quite a few queries and requests from clients on how to move their WordPres site to the root directory.

We’ve noticed that site owners want to do one of three things:

    • Make the subdirectory the main website, i.e., to
    • Make the subdomain the main domain i.e., to
    • Clean up the WordPress directory by moving the website’s files out of a subfolder into the main folder that is usually moving public_html/blog to public_html.

As always, there’s a hard way and an easy way to do things. To carry out this WordPress migration process, you can use two methods:

    1. Move WordPress Files Using A WordPress Migration Plugin (Easy)
    2. Move WordPress Files Manually By Modifying WordPress Files (Hard)

We’ve detailed the steps for both processes. Let’s begin.

1. Move WordPress Files Using A WordPress Migration Plugin

Using a WordPress migration plugin is much easier and efficient. The key is to pick an efficient and reliable plugin because many times migration plugins fail.

When you use BlogVault’s migration plugin, you don’t have to worry about the technical process. Migrating between folders and domains is as easy as clicking a few buttons. And it only takes a few minutes to get the job done.

You can use the steps below to perform all three tasks we mentioned above, i.e., if you want to make subdomain or subdirectory the main domain and if you just want to move the WordPress files from a subfolder to the root directory.

Step 1: Activate BlogVault on your site on your subdomain. Select the plugin from your WordPress dashboard, enter your email address, select migrate, and Get Started.

BlogVault on WP Dashboard

Step 2: BlogVault will take a few minutes to sync with your website. It will create a complete backup of your subdomain. Next on the BlogVault dashboard, under Backup, select Migrate.

Migrate option on BV

Step 3: You’ll be directed to a new page where you need to enter your FTP details. If you don’t have your FTP credentials, use our guide to Finding Your FTP Credentials. Alternatively, you can contact your web host and ask them.

Enter FTP credentials on BlogVault

Step 4: Now, you can select the folder in which the WordPress installation of your subdomain resides. This folder is usually public_html/nameofsubdomain. To illustrate, we’re moving our subdomain called to Our subdomain resides in a folder called demo. So we’ve selected the folder public_html/demo.

Step 5: In the last step, you need to choose the backup copy you want to use. BlogVault selects the latest copy by default, so you can skip this. Next, enter your destination URL – this is your main domain.

For us, the subdomain is Hence, is our destination URL

Select backup and php version on BV

Now your subdomain will have its own database. When you move your WordPress files, you also need to reconnect it to your subdomain’s database.

With BlogVault, you don’t have to worry about this step. The plugin will automatically fetch your database information. Click on Continue and handle the technical part of this process.

Migrating your website between different folders is a major process. We recommend testing your website after the migration is complete. Make sure all your pages bear the main domain name. Check out our migration checklist of things you need to verify after moving your subdomain to your root folder.

That’s it! You’ve successfully migrated your website from a subdomain to your root domain.

Recommended read: Migrate WordPress site to new domain

2. Move WordPress Files Manually By Modifying WordPress File

If using a plugin isn’t for you, we’ve entailed the manual process below. But before we begin, we must caution you that this method carries a high risk of breaking your site.

When you move your WordPress files around, you have to follow it up by changing a few settings on your dashboard as well as modifying WordPress core files. Any misstep in this process can lead to a completely broken website. If you aren’t tech-savvy, we don’t recommend following through with this process.

That said, we’ve listed out the steps you need to take before we begin this process:

Things To Do Before Moving WordPress From Subfolder/Subdirectory To Root

1) Backup Your Website

The first and most important thing to do is take a complete backup of your WordPress site. As we mentioned, this process is a bit risky and has the potential to break your website. If things go wrong, you can quickly restore your site to normal.

To take a backup, activate BlogVault on your subdomain. Select the plugin from your WordPress dashboard, enter your email address, select migrate, and Get Started.

The plugin will automatically take a complete backup for you and store it safely. If any error occurs, you can restore your website with a single click.

2) Access Root Directory In cPanel Or FTP

To move your WordPress site from a subdomain to the main domain, you need to move and modify your WordPress files. To move your files, you need access to File Manager which is found inside cPanel.

Login to your web hosting account and find cPanel here. It might be under the option Advanced Options or under your Web Hosting Plan.

cpanel on web host

Inside cPanel, go to File Manager where you’ll see a folder called public_html. This folder is where your website’s files and folders reside (unless in the rare case you’ve created a separate folder outside of public_html). We’ll be using this folder a lot in this process.

Alternative: If your WordPress hosting provider doesn’t offer this feature, you can use FTP (File Transfer Protocol) to connect to your website’s files. You need to download an FTP client like FileZilla.

Open FileZilla and enter your FTP credentials. If you can’t find your credentials, contact your web host for them. You can also follow our FTP guide or video on finding FTP credentials.

FTP credentials

FileZilla will establish a connection with your web server and populate your website’s directory on the right panel. Here, you’ll see the folder public_html.

public_html on FTP

3) Remove Old And Duplicate Files From The Root Directory

Once inside the public_html folder, check if you have any old WordPress files. Create a folder and name it backup. Move all old site files and folders into this backup directory.

Why clear out your root directory? When you carry out the next steps, you’ll be moving your WordPress files such as index.php into the root folder. If you have an old index.php or index.html file in the root directory, this will confuse WordPress as to which file to choose. This can break your website.

Also ensure you don’t have any folders in your root directory that have the same name as any of the pages on your website. If you have a page called ‘About us’ in your subdirectory, and the same page named ‘About us’ in the root directory, when you move your site, duplicate files and folders will confuse the browser.

4) Clear Your Cache

If you’re using a caching plugin, delete your cache and deactivate the plugin. When you make the transition, clearing your cache will ensure that any old content is deleted and only the changes are visible on your site.

5) Activate Maintenance Mode

The manual process takes time. During the process, if someone tries to visit your website, they will see errors and a broken site.

You can put your website in maintenance mode before starting this process. There are a number of plugins that will help you do this with the click of a button.

Steps To Manually Move WordPress From Subfolder/Subdirectory To Root

Step 1: Login to your WordPress dashboard. Navigate to Settings > General. Here, change the two fields WordPress Address and Site Address.

WordPress Address and Site Address URL on WP

Ensure the URL doesn’t have a slash at the end. Both fields should end with .com or or .org, whichever your domain type is.

Once done, Save Changes.

Step 2: Access public_html. You can do this through cPanel or using FTP as we detailed above. Inside public_html, open your subdomain’s folder. Select all the files and right-click to get a drop down menu. Select Move.

Move files on cPanel

A pop-up will appear like so:

Select public_html

Ensure the file path says /public_html.

Step 3: Now that you’ve changed your website’s folder, you need to log back into your WordPress site. This should be

Step 4: Once you’ve logged in, go to Settings > Permalinks. Here choose the type of permalinks you want which is usually Click on Save Changes. This process will overwrite your .htaccess file and will remove your subdirectory from your website’s page URLs.

Step 5: You need to update your URLs. The easiest way to do this is to use a plugin. You can Velvet Blues Update URLs.

Velvet Blues Update URL

Your old URL would be either or Replace blog with the name of your subdomain or subdirectory.

In the New URL field enter your domain name like Make sure there is no trailing / at the end. Under Choose which URLs should be updated, select all boxes except the last one Update ALL GUIDs. Then select Update URLs NOW.

Step 6: You need to test your website to ensure everything is functioning fine. Check your main URLs and make sure that none of them show your subdirectory or subdomain URL.

A few problematic areas to check:

    • Custom menu items that you can find under Appearance > Menu
    • Logos and Favicon files that are present under Appearance> Theme Options
    • Any slider images or slider URLs. You can edit the slider and manually remove any subdirectory URLs.
    • Any button links or custom theme layouts.

With that, you’ve successfully moved your WordPress site from a subfolder to the root folder. You can delete your old empty subfolder. Your root folder will now look like this:

move wordpress site to root

Step 7: One last step we recommend you take is called a wild card redirect. This will ensure all your SEO efforts are not lost. You need to redirect your subdomain’s traffic and SEO history to your main domain.

Go to public_html, locate your .htaccess file, right-click and select Edit.

PRO TIP: If you can’t find your .htaccess file, go to settings, and select ‘Show hidden files’.

Show hidden files .htaccess

Insert this snippet of code into your .htaccess file:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^$ [OR]
RewriteCond %{HTTP_HOST} ^$
RewriteRule (.*)$$1 [R=301,L]

Substitute and subdirectory with your own website’s name and the subfolder. Maintain consistency with your website’s URL. If you use www in your URL in Setting > General, ensure the same is inserted here. If you don’t use www and use just, use the same here.

Once done, save the file and exit.

PRO TIP: The redirect used here is 301 and this is a permanent change. To be on the safe side, you can start with setting this to 302 which is a temporary change. Test your URLs and make sure everything is working correctly. Once you’re confident it’s working, change this redirect to 301. Google will redirect your SEO credit from the subdirectory to the main domain.

With that, we’ve come to the end of our guide on how to move your WordPress site from a subdirectory or subdomain to your root directory.

Final Thoughts

WordPress is the most popular platform to build a website because it makes it so simple for just about anyone to use it.

You can do most of the tasks from the dashboard or by using a plugin. When it comes to moving your WordPress files, it’s quicker, safer, and more efficient to use a plugin to do the task for you.

You can rely on the BlogVault migration plugin to safely move your WordPress files from your subdomain to the root folder and vice versa. The three-step process ensures your site is migrated correctly without errors. And the best part, you don’t have to worry about the technical part of it.

Move Your WordPress Site Using BlogVault’s Migration Plugin

Would love your thoughts, please comment.x