If you have chosen to build your Joomla website inside a sub-folder of an existing hosting account, you might be unsure of the easiest way to replace the old site with your new one. There are a few ways you can do this, but in this tutorial, I’ll show you how to achieve this using your hosting control panel. I’m using cPanel, but the principles apply with other control panels, as long as they include a file manager as you’ll see shortly.
This video is best viewed at full screen:
Step 1 - Backup everything. If you mess this up and you don’t have a backup, you could lose both your new site and your old one! You can do this using the cPanel backup feature.
Step 2 - Login to your control panel and go to the File Manager.
Step 3 - Navigate to the folder that contains your web files which in cPanel is public_html. Your current website files are displayed along with the folder that contains the Joomla website.
Step 4 - Click the New Folder button and enter a name like old.
Step 5 - Click the Select all button above the listing. But then deselect the folder containing your Joomla installation and deselect the new folder you created in the previous step. You do this by holding the Ctrl key on Windows or Command key on a Mac and clicking each folder.
Step 6 - Click the Compress button. This opens a new window. Choose the first option - Zip Archive. Then in the address box, insert the name of the new folder after public_html and give the zip file a helpful name such as archive.zip. So in this example, the full path is /public_html/old/archive.zip
Then click the Compress file button. This compresses all of your old website files and stores them as a zip file in the folder you created in step 4. When this process is complete, you might like to navigate to this folder and confirm that the zip file was created correctly. Right-click on the file name and choose View to check the contents of the zip file.
Step 7 - Return to the main folder if necessary and then Select All. Once again, make sure you deselect the joomla folder as well as the archive folder you created.
Step 8 - Click the Delete button and then confirm the delete action. As long as you do this properly, this step will just delete the current live site files.
Step 9 - Navigate to the joomla folder. Select all and click the Move File button. In the path box, remove the folder name so it just reads public_html. Then click Move Files. When complete, navigate to the main folder again and check that the Joomla files are there.
Step 10 - Select configuration.php and click the Code Editor button. Scroll down towards the bottom and find the line starting with public $log_path. At the end of this line you’ll probably find that the name of the previous development folder is included. Remove this so it reads public_html/logs. Do the same on the next line so the line ends with public_html/tmp. Click the Save Changes button towards the top right.
Now open a new browser tab and go to your web address. With any luck, all will be fine, but check all pages, especially any images and links.
If something does go wrong, you can move the Joomla files back to where they were, move the archive file into the main directory and use the Extract button to return things to the way they were while you try to troubleshoot the problem. If you do have problems, the quickest solution might be to simply try making a backup of the Joomla site using Akeeba Backup and restore it into the main folder using Akeeba Kickstart. This is demonstrated in our Beyond the Basics series. But before you do that, there are a couple of things to check. Go back to the configuration.php file and ensure that there is nothing entered in the line starting with var livesite. If there is, make sure the previous folder name is not present. Another place to check is the .htaccess file. If you entered something next to the RewriteBase line, comment this out by inserting a hash at the beginning of the line.
And that’s how you move a Joomla site from a sub-folder to the main folder using cPanel.