How to Change a Joomla Website Address
This tutorial contain 2 sections. The first section involves modification of configuration.php file and the second part involves MySQL database modification.
Login to your cPanel account and select File Manager under the Files section.
Inside File Manager, locate the path where configuration.php is stored. Normally, this is located inside the public_html folder (provided you install Joomla in your root domain e.g. www.yourdomain.com). If you install Joomla in a subdirectory, the file is located in /public_html/yourdomain.com/subfolder
In our example, we are going to edit the configuration.php file obtained inside the Joomla subdirectory. Press the Edit button as highlighted and hit the edit button again once the pop-up appears.
Edit public $live_site and enter your new Joomla website address as shown below.
On the same page, scroll down and edit both public $log_path and $tmp_path. You need to make sure your path is properly set or else error message shall appear.
Once you're done, press the Save Changes button at the top right corner and hit the Close button.
NOTE: Now make sure that you have actually moved all the files to the new folder where your new Joomla domain is located.
Now we shall move to second part, which is backup and edit your Joomla database. In order to edit the database, please follow these steps.
Login to cPanel > File Manager and locate the configuration.php file. This time edit the configuration.php and look for public $db =. Make sure to copy down this data which is very important.
Press the close button and return to your cPanel. Next, click on phpMyAdmin under the databases section.
You will be redirected to phpMyAdmin. Click on your Joomla database name e.g. joom760 and press the check all button as seen below. Click the drop down box and select "Export".
Tick the boxes for Custom and Format: SQL
On the same page, scroll down and check all the boxes as follow:
Press the Go button on the bottom of the page to begin your database download (SQL).
Now open your newly downloaded SQL file by using Wordpad. Use the Search and Replace function (CTRL+H) to replace old Joomla domain/path with the new domain name/path. In our example, we shall use the Search and Replace function to replace the old path into a new path e.g. from www.myjoomladomain.com/joomla/ to www.myjoomladomain.com/joomla2/
Once replacement is done make sure that you save the changes.
DO NOT USE MS WORD FOR THIS EDITING WORK. ONLY USE WORDPAD
Now you can upload the updated database to your cPanel account. To be on the safe side, we suggest creating a new database (instead of dropping the existing one) and connect it to your Joomla site. To do so, move to Databases section > MySQL Databases menu:
You may follow this complete tutorial here to perform this task.
Remember to save the newly created database name and username once you have performed the above tutorial.
After that you can upload the database using phpMyAdmin menu:
Select the newly created database from the list on the left and switch to Import tab. There you will need to use Browse option to pick up the database .sql file from your local device:
Press the Go button.
Once done, go back to File Manager and find configuration.php. Edit the following lines with the new database details:
public $user = 'USERNAME';
public $password = 'PASSWORD';
public $db = 'DATABASE_NAME';
That's all. You can now test your new Joomla website.
Section 1: Edit Configuration.php File
Login to your cPanel account and select File Manager under the Files section.
Inside File Manager, locate the path where configuration.php is stored. Normally, this is located inside the public_html folder (provided you install Joomla in your root domain e.g. www.yourdomain.com). If you install Joomla in a subdirectory, the file is located in /public_html/yourdomain.com/subfolder
In our example, we are going to edit the configuration.php file obtained inside the Joomla subdirectory. Press the Edit button as highlighted and hit the edit button again once the pop-up appears.
Edit public $live_site and enter your new Joomla website address as shown below.
On the same page, scroll down and edit both public $log_path and $tmp_path. You need to make sure your path is properly set or else error message shall appear.
Once you're done, press the Save Changes button at the top right corner and hit the Close button.
NOTE: Now make sure that you have actually moved all the files to the new folder where your new Joomla domain is located.
Now we shall move to second part, which is backup and edit your Joomla database. In order to edit the database, please follow these steps.
Section 2: Backup & Edit MySQL Database for Joomla
Login to cPanel > File Manager and locate the configuration.php file. This time edit the configuration.php and look for public $db =. Make sure to copy down this data which is very important.
Press the close button and return to your cPanel. Next, click on phpMyAdmin under the databases section.
You will be redirected to phpMyAdmin. Click on your Joomla database name e.g. joom760 and press the check all button as seen below. Click the drop down box and select "Export".
Tick the boxes for Custom and Format: SQL
On the same page, scroll down and check all the boxes as follow:
Press the Go button on the bottom of the page to begin your database download (SQL).
Now open your newly downloaded SQL file by using Wordpad. Use the Search and Replace function (CTRL+H) to replace old Joomla domain/path with the new domain name/path. In our example, we shall use the Search and Replace function to replace the old path into a new path e.g. from www.myjoomladomain.com/joomla/ to www.myjoomladomain.com/joomla2/
Once replacement is done make sure that you save the changes.
DO NOT USE MS WORD FOR THIS EDITING WORK. ONLY USE WORDPAD
Now you can upload the updated database to your cPanel account. To be on the safe side, we suggest creating a new database (instead of dropping the existing one) and connect it to your Joomla site. To do so, move to Databases section > MySQL Databases menu:
You may follow this complete tutorial here to perform this task.
Remember to save the newly created database name and username once you have performed the above tutorial.
After that you can upload the database using phpMyAdmin menu:
Select the newly created database from the list on the left and switch to Import tab. There you will need to use Browse option to pick up the database .sql file from your local device:
Press the Go button.
Once done, go back to File Manager and find configuration.php. Edit the following lines with the new database details:
public $user = 'USERNAME';
public $password = 'PASSWORD';
public $db = 'DATABASE_NAME';
That's all. You can now test your new Joomla website.
Updated on: 28/01/2019
Thank you!