move WP subdirectory to root


The Less Fuss Method

It Does Not Require You To Move All The Files or Edit The Database.

This allows you to work on a WordPress website, while your current site is still running from the root directory, until you are ready to have your new WordPress site run in place of the current root directory.

Your WordPress site installed in a Subdirectory

Your WordPress site installed in a Subdirectory

Make a Backup

It is always a good idea to make a backup of your WordPress site and your original site from the root directory prior to making any changes. (Tutorial on Cadre site for WP manual backup)


After backing up the original site, remove those files with cPanel File Manager or an FTP program

Remove the old/current site files from the root directory and corresponding folders, but leave your current index file ( index.html ) in the root folder until the WordPress Folder move has been completed. Upon completion, the index.html will be renamed (as explained below). Also retain any files/folders that you may have linked/used in your WP installation.

If there is another WordPress site in your root directory, you must remove the root files and the database files also for that installation. (Make sure which database you are removing)


Prepare your WordPress installation for the move

Steps needed to make your WordPress installation work from root directory but stay in the same subdirectory.

  • Log into your WordPress Dashboard.
  • Turn off caching and security plugins, clear cache (This keeps out old information or blocking by security)
  • From the main dashboard, go to Settings –
  • Settings – Permalinks – Turn off pretty permalinks (if you have anything but default ticked in the Permalinks screen). Do this by selecting the Default option and clicking Save Changes.
  • Settings – General
  • Change the address of your site but not the address of WordPress. WordPress address (URL): ( — Currently they are the same
  • Look for the Site Address (URL): and change it from ( to (or .net or .org etc.)

Before accessing your site, you have to copy two files and make minor edits to a file, so that WordPress knows where to serve the site.


Editing and Copying Files

Using FTP or CPanel file manager, COPY (don’t move) the following files from your WordPress installation in the subdirectory to your root directory:

  • index.php
  • .htaccess – (Turn on Show Hidden Files to see this file – yes this file has nothing in front of the dot)- If there isn’t an .htaccess file, don’t create one – just skip this step.

Edit the index.php file that you’ve copied and moved from the subdirectory. (Remember, you must leave the original copy of index.php in your wordpress directory!) Do not edit the file that you leave in the WP subdirectory folder. Edit methods:

  • editing it in place after the copy/move, using an FTP client or cPanel file manager file editor
  • downloading it from the subdirectory, editing it in a text editor and then uploading it to the root directory — instead of making a copy

The change you make is to one line at the end of the file. Find the line:

require( dirname( __FILE__ ) . '/wp-blog-header.php' )

Change “/wp-blog-header.php” to “/wordpressfoldername/wp-blog-header.php”:

require( dirname( __FILE__ ) . '/wordpressfoldername/wp-blog-header.php' )

Make sure you give it the exact name of the folder and do not make extra spaces or characters.

Save the new index.php file and make sure it is uploaded to your root directory.

You will not have to edit the .htaccess file, unless you have other conditions to meet.

Copy, Edit and upload to Root Directory

Copy, Edit and upload to Root Directory

Once the new index.php file is uploaded to the root directory, rename index.html in the root directory, changing its name to maintenance_index.html.

Tip: Remember that if you have two index files in a directory, your website is set up to load index.html rather than index.php (note the alphabetical order of the file types).

(Whenever you are doing any kind of extended maintenance on your wordpress site, you can rename maintenance_index.html in your root folder to index.html and your visitors will see what you want them to see rather than WP’s generic “under maintenance” page.)



In your WordPress dashboard, turn pretty permalinks on again if you had set them to other than default, with whatever you had set before and save. Reactivate your cache and security plugins (if used).

Now view your site in the browser and it should display the site that’s stored in the subdirectory, but won’t show this in the URL, which will be displayed as the root URL. If not, try resetting and saving permalinks, check index.php file for spelling and content from saving, check plugins for conflicts with linking or deactivate plugins then reactivate plugins.

Your WP admin login will still be the original one you used all along.