Recently I was faced with a dilemma where my host’s cPanel did not allow me to install WordPress into the root directory (i.e. without creating a new folder). If I left the instllation URL blank, it returned the error, “You must specify an installation directory!”. This particular host was using ‘Site Software v0.9.7′ for WordPress installation, and not Softaculous which I much prefer (Softaculous allows you to leave this field blank).
In any case, I searched for a solution on the matter and it was recommended that I nominate public_html as the folder since this is where all the public files exist. This was a poor suggestion though, because the automatic installation software ended up creating and installing into that folder, rather than using the host’s root directory. In the end, however, it made no difference because I would still need to move the files, regardless of the folder’s name.
Anyway, how do you (easily) move WordPress to the root directory?
Essentially there are only three main steps:
- Update your URL in WordPress’ general settings
- Move files from current folder into root directory
- Update the file path for uploaded media (see the comment below the article)
… Simple enough, but I’ll outline all the little details in between so as not to make any assumptions about your WordPress expertise. It’s important to follow these steps in the correct order. Also, please note that your site will be down during the time it takes you to move the files from one folder to the other (usually less than a minute).
- Back up any files in your root directory, such as index.php or your htacess file.
- Log in to your WordPress website and go to Settings > General (if you’ve only just installed it, this will be;
- In both the WordPress and Site Address URL fields, backspace over the folder name where WordPress is currently installed so that only your full domain name appears (e.g. ‘http://www.freenichewebsites.com’).
- Next, don’t panic! When you click Save your site will be (temporarily) inaccessible.
- Go back to your cPanel, then open File Manager.
- Open the folder where WordPress is installed by double-clicking the folder icon.
- Select all files in the directory (hold down CTRL or use SHIFT while selecting).
- Next, click the ‘Move File’ icon from the cPanel toolbar (a dialogue box will open displaying all the files that will be moved).
- In the last field of the dialogue box, you want to delete the folder name so that cPanel will move the files into the root directory (i.e. into ‘/public_html’). When ready, click ‘Move File(s)’.
- Lastly, while still in cPanel, go back to the root directory and DELETE the folder (which should now be completely empty).
- Your site should now be up and running in the root directory of your domain. [Edit February 21, 2014: There is one additional step - see the comment further below.]
The reason why we use cPanel and not FTP to move the files, is that the server will be much faster to complete the process. Like your hard drive, it can perform this function in seconds, rather than hours, and it avoids unnecessary downloading and uploading of your files.
I hope this has helped. As always, you’re welcome to leave a comment if you need something clarified.