How to Move Joomla from Localhost to Server
Moving a Joomla website from localhost to a server is basically the same as moving it from one hosting server to another. You only need to upload the website files to the hosting server, import the database and adjust Joomla configuration to match new server settings and domain name.
Start by uploading all files to the new server. You can use any FTP client to do this. You will need to connect to the FTP server by using the login details given by the hosting service provider. Be sure to set up the domain name in the hosting server control panel as the files need to be uploaded directly to this domain public_html directory.
Once all files are uploaded, you will need to create a database in server control panel. This can be done in the MySQL management area. Connect to the MySQL server by using MySQL client, such as phpMyAdmin. It can be accessed by adding “phpmyadmin” at the end of the domain name like “www.domain.com/phpmyadmin”. Once logged in, select the newly created database and go to the “Import” tab to start importing the database tables.
Select the database file from the local drive by clicking the “Browse…” button. Note that the database file format should be .gzip, .zip, .sql.zip or .sql.
After the database is successfully uploaded, you should see its tables by clicking on the database name.
The last thing you need to do is to adjust the Joomla configuration file in order to match the database, website URL, log and tmp directory paths. Navigate to the directory where Joomla is currently uploaded and find the file “configuration.php”. Open it and locate the following lines for database settings:
1 2 3 4 5 6
public $dbtype = 'mysql'; public $host = 'localhost'; public $user = 'database_user'; public $password = 'password'; public $db = 'database_name'; public $dbprefix = 'jos_';
Edit the values between ‘ ‘ by replacing them with correct details of the database name, username and password of the new server. Database host can remain “localhost” as we will be using the local MySQL server which is running on the same server as our website.
You will also need to change the line in which the website URL is defined. If you have used the same domain name on the local server, there is no need to change it when website is hosted on the hosting server. However, if you will be using a different domain, find and change it in the following line:
public $live_site = ‘domain.com’;
Finally, edit the path for logs and tmp directory. They can be adjusted by editing these lines:
public $log_path = '/home/username/domains/domain.com/public_html/joomla/logs'; public $tmp_path = '/home/username/domains/domain.com/public_html/joomla/tmp';
The path structures in the local and hosting server might be different. Therefore, you might need to adjust them accordingly.
If everything was set correctly and there are no errors on the website, you have transferred the website to a new server successfully.