How To Move Your WordPress Site To Root Directory


Bart Keating


2019 February 6th at 4:57


Your site might have accidentally been installed in the wrong location - or you might need to transfer changes from a staged version to your live website.

For those things (and several more) you need to know how to move WordPress site to root directory.

And it's actually pretty simple if you know the right steps.

This is what I'm here for. This is how you to move WordPress site to root - in 8 simple steps:

  1. Backup your WordPress database
  2. Log into your server's control panel
  3. Find and log in to your server's FTP client
  4. Navigate to your WordPress subdirectory
  5. Copy the WP files to root
  6. Verify Your WP Files are in the root directory
  7. Edit WordPress URL settings
  8. Edit subdomain htaccess file

After I've explained that process, I'll also tell you how to move WordPress to subdirectory too.

Step 1. Backup your WordPress Database

Before attempting to move your WordPress site to your root directory, you should back it up. If you make an error while transferring WordPress folders, you could easily corrupt a vital settings file and break your website.

There are plenty of excellent backup plugins you can use (such as UpDraftPlus) but if you'd rather maintain control over the whole process, you can do it manually by following our WordPress backup guide.

Step 2. Log into your server's control panel

The first step to move WordPress site to root is to access your server's control panel.

To log in, you will need the username and password you set when you began your hosting contract. If you can't remember what you chose, check your email inbox as a large number of web hosts send out automatically generated credentials.

Has that not worked? Open a support ticket with your host.

Once you've managed to enter the control panel, you'll be greeted with a screen that looks something like this:

Move WordPress_Site To Root cPanel Dashboard

Web hosts use control panels of all shapes and sizes, so if yours looks a little different from the screen above (which is cPanel, the most common control panel) then don't worry; you'll still be able to change WordPress directory with ease.

Step 3. Find and Log In to Your Server's FTP Client

To access your WordPress directory, we are going to use your server's FTP service, a standardized way to transfer files and folders between your computer and your server directories.

Within your control panel interface, search for and then click an icon labeled either 'FTP accounts' or just 'FTP'.

Move WordPress_Site To Root cPanel FTP Button

If you haven't used your FTP client before, you will now see a page that should allow you to set your own login user name and password to access your server via FTP.

Move WordPress_Site_To_Root cPanel FTP Set Credentials

Simply pick some memorable login details and then head over to the URL listed at the top of the page. 

If your web host has an inbuilt FTP client, you'll be able to access your FTP directly through your browser. If your host doesn't, you'll need to make use of an FTP client such as FileZilla.

Step 4. Navigate to WordPress Subdirectory

Within your FTP client, you now need to navigate to the subdirectory that matches the subdomain that WordPress is currently installed on.

If WordPress has been installed in a strange location, finding the correct subdirectory may take a few minutes.

You will know when you are in the right place as the WordPress installation files and folders will be called things like 'wp-admin' and 'wp-activate.php'.

Move WordPress Site To Root WP Subdirectory

Step 5. Copy the WP Files to Root

When you are certain you've managed to find the correct subdirectory folder, it's time to copy the WordPress installation files and folders from the subdirectory to your root directory.

To do this, click the tickbox at the top of the screen to highlight every file and folder. 

Move WordPress Site To Root TickBox

When all of the files are highlighted, right click on one of them and click 'Copy'.

Move WordPress Site To Root Copy Files

This will bring up a screen where you can select a location for your WordPress files to be copied to. You can verify that every WordPress folder has been correctly highlighted because there should be 21 different elements selected.

Set the destination for your copied files as your server's root folder by clicking 'Change' in the 'Destination' section of the window. 

Move WordPress Site To Root Copy Location

In the pop up that appears, select your root folder. The name of your root folder will vary depending on your precise server set up, but in many cases, it will be named 'public html' if set to default.

Move WordPress Site To Root Select Root

Once you've reached your root folder, hit the 'SELECT THIS' button. You will be returned to the previous window where you can then click 'COPY'. 

Step 6. Verify Your WP Files are in the Root Directory

Now that you've gone through the process of transferring your WordPress files, it's worth double checking that your WP files have been moved to the desired destination. In this case, you want to see them in your root directory.

To do that, navigate to your root folder and verify that all 21 files and folders from your subdirectory are now there.

Move WordPress Site To Root WP Verification

Step 7. Edit WordPress URL Settings

Of course, simply changing the directory of your WordPress files won't actually link your site to your root domain.

To do that, you'll also need to edit your site's URL settings. They're stored in a file named 'wp-config.php' which, if you followed the instructions above correctly, you'll be able to find in your root folder.

Right click on the wp-config.php file and select 'edit'.

Move WordPress_Site To Root Edit WP config

Toward the end of the file, you'll see a line that says:

/* That's all, stop editing! Happy blogging. */
Move WordPress Site To Root wpconfig Edit

Immediately before that line, insert the following code:


Make sure you replace '' with your website's URL. Your modified wp-config.php file should now look like this:

Move WordPress_Site_To_Root wpconfig Editing Complete

Step 8. Edit Subdomain htaccess File

To prevent readers who have your old subdomain address from seeing the wrong site, you need to redirect them to your root domain.

In your FTP client, head back to the old subdomain folder and locate the '.htaccess' file. Right click on it and press 'Edit'.

Move WordPress Site To Root htaccess location

Highlight and erase all of the code in the htaccess file and replace it with the following:

<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^oldsubdomaingodeshere\.yoursitegoeshere\.com$ [NC]
RewriteRule ^(.*)$ "$1" [R=301,L] </IfModule>

Once again, substitute 'yoursitegoeshere' for your root domain name, and 'oldsubdomaingoeshere' for your old subdomain.

Your htaccess file should now look like this:

Move WordPress Site To Root Edit Htaccess

Now just click 'Save & Close'.

Congratulations! You have finished moving WordPress site to root!

Final Note - How to Move WordPress to the Subdirectory

You can easily apply the steps above in reverse to move a WordPress site from your root directory to a subdirectory.

Simply copy the WordPress files from the root directory to the subdirectory instead, and substitute the two URL addresses for one another in the code you insert.

Good luck!

Bart Keating

Experienced in copywriting, SEO and creative writing (journalism, blogging, poetry, lullabies etc.). Public communication bachelor and HoReCa expert. A strange sense of humor but bearable. Has a beard, a cat, a fiancee, a hedgehog, and a brand new pug.

Related posts

4 Best CMS Platforms That Are Absolutely Free Of Charge!
Avatar gfdgdgdgdgd Bart Keating


2019 January 18th

CMS (Content Management System) platforms offer a broad range of features - such as brilliant site maintenance, workflow tools and the ability to edit...

5 Best Blogging Platforms For Your Brilliant Blog
Avatar gfdgdgdgdgd Paul Mahony


2019 August 16th

Starting blog is a hard task but once you get over your insecurities and inner demons, it can be a lot of fun! Now...

5 Best MailChimp Alternatives: Which Marketing Automation Tool to Choose?
Avatar gfdgdgdgdgd Dani Nolan


2019 January 7th

If you ever needed an email marketing tool - MailChimp was definitely in your list of considerations. The dominating email automation tool has been...

Top 3 Hosting Providers
Hostinger logo
9.5 /10
BlueHost logo
9.4 /10
GoDaddy logo
9.1 /10
Leave a Comment


faheem picture

2019 August 30th

how about back up my old site and ,and removing all folder in root directory and install wordpress to main domain and migrate my wordpress website in the sub domain to new wordpress –
is it work

John Gulka picture
John Gulka

2019 June 7th

Bart, In reading about a half dozen articles on moving a WordPress Dev site to production, (from a sub-directory to a new domain) yours is about the best out there. Specifically steps to redirect visitors to the old site to the new, and the clean up steps.
However the one thing I don’t see in your article is moving the databases to the new domain. If I’m reading this correctly, FTP will not capture the MySQL databases associated with the WordPress files. Where did I miss this?