How to Change URL of the Joomla Website in cPanel?

Posted on October 24th, 2018

How to Change URL of the Joomla Website in cPanel?

We can change Joomla site URL by editing the configuration.php file. Consider the scenario you want to change your domain name to a new one. You can change it in the configuration.php file but there is a lot of URL in the Joomla database because most of the pages are fetching from the database. In this tutorial, we will show how to change the URL of the Joomla.

1) Login to cPanel and go to “File Manager”.

2) Then locate document root of the website and open the file configuration.php.

Find the entry.

public $live_site=’’;

Then replace domain name instead of old domain name.

public $live_site=’’;

3) Save the changes.

4) Then find database name of your Joomla site. You can find this from the configuration.php file.

Before editing the database, you need to take a backup of your database. In case the process is failed. you can restore the database from the backup.

Otherwise, you can take database backup via phpMyAdmin.

Login to cPanel >> DATABASES >> phpMyAdmin.

5) Select your Joomla database and then click on “EXPORT ” in the top menu.

6) Once the export process is completed, you can take a copy of that .sql file for the backup.

7) Then open that exported file with a text editor (eg. Notepad).

8) Find all of your old URL and replace with new one.

9) Once you have replaced all URLs, save this .sql file

10)Now you can import this .sql file to your Joomla database.

11) Login to cPanel>>DATABASES >> phpMyAdmin.

Select our Joomla database and then click on “IMPORT” in the top menu and then select the .sql file which you have replaced URL.

You may refer following KB to import SQL file


Replace URL via CLI

If you have SSH access, you can take database backup simply run a command. Also, you can replace URL by using sed command

1) Login to the server via SSH

2) Run the following command to take database backup.

mysqldump -u dbuser -p dbname > dbname.sql

3) Take a copy of the backup file

cp -p dbname.sql dbname-bak.sql

4) Run the following command to replace URL.

sed  -i  ‘s/orginal_entry/newentry/g’   dbname.sql

5) Run the following command to restore the new database.

mysql -u dbuser -p dbname < dbname.sql

6) If this replacing process failed, restore the old database

mysql -u dbuser dbname < dbname-bak.sql


If you need any further assistance please contact our support department.



Leave a Reply