How to move your Joomla application from a subfolder to the root folder.

It is always a good idea to test your new site in a non-live location so that you can work with it, test, and make changes prior to making it live. Most often this is done in a subfolder, for instance https://example.com/test when example.com is the live site that visitors will see.

However, once you have decided to move the test site to the live section, you will need to know how to move it smoothly so that there are no errors. This article goes over how to move your Joomla site from a test subfolder to your root folder. This specifically assumes that you are not using a Joomla site as your main site prior to the move. Moving a site like this should only take a couple of minutes.

Preparing for the move

Before you do anything major to your site, you always want to make sure you have a backup plan. If something goes wrong during the move, you may need to roll back to your previous site while you investigate what went wrong. To that end, you need to make some preparations beforehand.

Make a cPanel backup

One of the easiest things to do is to make a cPanel backup of your site files. This allows you to have a copy on hand that can be restored by our Live Support team for you.

Make a copy of the public_html folder

In this case, another option is to make a copy of your public_html folder. Simply copy the folder and name the new copy something like public_html2 or public_html_backup. It can be anything you like really, but make it somethig you will remember should you need it. Should something go wrong, all you will need to do is to delete the current public_html folder and then copy the backup again, naming it public_html. That way you reset the folder and can start again. This method allows you to do so without having to involve our Live Support team and can save you some time.

In our example, we will take the second option and make a copy of the public_html folder. Below you can see that we originally had a public_html folder under the root folder and now we have a public_html2 folder as well. It is a duplicate copy of the public_html folder.

BEFORE/AFTER IMAGES HERE

Moving the files

  1. Log into your cPanel dashboard.
  2. Use the File Manager and open it to your public_html folder.
  3. Navigate to the folder that contains your Joomla application.
  4. HIghlight ALL files and folders in the directory.
  5. Use the Copy feature in the cPanel to copy all the files and folders in your main Joomla folder up to the public_html directory. (Note that this will overwrite any files in the public_html folder that have the same name, commonly such as index.php, etc. But it will not affect your backup copy, so do not worry too much about that.)
  6. Once certain that all files made it over during the copy you may now delete the old Joomla directory in the File Manager.

Changing the configuration files

Now that you have copied the files over to the root directory for your account, you need to make some changes to your configuration file so that Joomla knows the new location for the files.

  1. Log into your cPanel dashboard.
  2. Use the File Manager and open it to your public_html folder.
  3. Use the Edit feature to open up the configuration.php file for editing.
  4. Locate the log_path and tmp_path settings. Note that they should will still be pointing to the subfolder like below:
    public $log_path = ‘/home/cpanel-username/public_html/joomla/logs’;
    public $tmp_path = ‘/home/cpanel-username/public_html/joomla/tmp’;

    Remove the old Joomla folder name so that the file appears similar to this:

    public $log_path = ‘/home/cpanel-username/public_html/logs’;
    public $tmp_path = ‘/home/cpanel-username/public_html/tmp’;
  5. Save the settings by clicking on the Save button in the upper right corner.

Now you can visit your site at the root domain (example.com) instead of using the former subfolder (example.com/joomla). If you have any issues, be sure to revisit the steps to ensure you did them correclty. If you are unsure where you went wrong, you may delete the public_html folder and then simply copy the backup public_html_backup as public_html.

Was this article helpful? Join the conversation!