How to move your Joomla website to new hosting ?
Copying a Joomla website to a new server is quite easy. However, you need to do it systematically to prevent any issues and minimize downtime. You can break down the entire process into two parts: copying the website files and copying the database.
These are separate operations, and which one should be carried out first entirely depends on you or the circumstances. For example, if your website is updated frequently and you take the website offline while copying the files to the new server, then you can minimize the downtime by copying the database files last. This is not a hard and fast rule, and it really does not matter what you copy first.
Now let’s take a look at the moving Joomla website process in detail.
Part 1 – Copying Website Files
There are different ways of copying Joomla website files to a new server. The most common method used is FTP. You will need FTP software to download all website files to your web server and then upload them to the destination, server which is the new Joomla installation.
You will be required to make few changes to the path of the files which depends on where your new Joomla installation would be, that is a new directory on the same web server or a completely new web server.
One of the important things to remember is that you need to maintain directory structure for all folders and files of your Joomla website. The good news is the FTP software will automatically do it for you, but you need to be familiar with the FTP interface to ensure transfer of files between servers happens in the right manner.
Note that even after maintaining the directory structure, you will be still required to make some changes to Joomla configuration files to make the website work at the new location. Also, you may be required to change some Web server aspects for the Joomla website to work.
In addition, ensure none of the website files have got corrupted, which is actually quite rare. You can know some files are corrupt if you get strange or unexpected errors in the new Joomla installation, specifically after the files have been copied to a new location. In such a case, you will need to upload the files again to the new server to overwrite corrupt files.
Now let’s look at detailed steps to download from old location to your computer server
Download website files to your computer/web server
- Use any FTP software to connect to your server(old installation)
- Select the directory you want to download. In most cases, /public_html/ or /htdocs/
- Right click + select folder/files to download from the “Remote Site” view to “Local Site” view
- The downloading of the file starts. Wait till the process completes
- After the download complete, check Failed errors to see if there were any errors
Upload website files from computer to new server
- Check the configuration.php has the right settings for the new server. You can view your current PHP settings for the server by creating a phpinfo page.
- Use any FTP software to connect to your new server
- Select the directory you want to upload and also select the destination folder on the server
- Right click + select folder/files to upload from the “Remote Site” view to “Local Site” view
- The uploading of the file starts. Wait till the process completes
- After the upload complete, check Failed errors to see if there were any errors
Part 2- Copying the database with PHPMyAdmin
The phpMyAdmin tool can be used to copy, export or import database to any server. It provides a simple way to replicate database for Joomla web hosting. Here are the steps you need to follow.
Exporting a copy of the database to your server/computer
- Log in to the database in the old Joomla installation using phpMyAdmin
- Click the database name appearing on the left-hand side of the page
- Select Exports tab
- Select Save as file option
- Click Go
- Save the database to your computer when prompted
Importing the copy of database to your new server
Before importing the database to your new Joomla installation, you need to create a blank database on the new server. You can create a new empty database on your server using the control panel. The new database should be UTF8 (utf8_general_ci). After you have created a new database, follow the steps given below.
- Log in to the database in the new Joomla installation using phpMyAdmin
- Click the database name appearing on the left-hand side of the page
- Select Import tab
- Click Browse button under Files to Import to navigate to the folder on your computer where the copy of database is downloaded
- Select the database from your computer
- Click Go to import the database
Changing configuration.php
For the Joomla website to work on the new server, you need to make certain changes to the configuration.php file. Here are some of the values that you should look for
- var $host = ‘localhost’;
- var $user = ‘the_db_username’;
- var $db = ‘the_databasename’;
- var $password = ‘the_db_password’;
- var $live_site = ”;
- var $cookie_domain = ”;
The last two values(live_site and cookie-domain) are empty. Now you have to login at back-end of Joomla website and check the directory permissions.
If you are using Joomla 2.5 – Go to Site-> System information-> Directory Permissions
If you are using Joomla 3 – Go to System-> System information-> Directory Permissions
Now look at the last 4 rows and their values
- cache (Cache Directory) Writable
- administrator/cache (Cache Directory) Writable
- /var/www/some/other/folder/example.com/logs/ (Log directory) Unwritable
- /var/www/some/other/folder/example.com/tmp (Temp directory) Unwritable
Since the last two values of log_path and tmp_path values are Unwritable, you need to change the values for the Joomla website to work. You need to enter the values mentioned in the Cache directory without the //cache// part. The values for log_path and tmp should look like
- var $log_path = ‘/var/www/myexample.com/logs’;
- var $tmp_path = ‘/var/www/myexample.com/tmp’;
With the log_path and tmp_path values changed to writable, you can install extensions for your Joomla installation on the new server.