Hosting Tutorial & Guide

How to Change the URL of a Joomla Website

updated on Apr 27, 2015
How to Change the URL of a Joomla Website Occasionally, there are good reasons to change the URL of a Joomla website. For example, you have purchased a better domain that matches the topic of your site. If you are prepared to do so but do not know where to start, this tutorial explains the whole process for making a change.

In some circumstances, you only need to modify the configuration file, but if you find that the modification does not lead to the proper result, you may also have to modify the database file. These two tasks are both discussed in below.

Make Change to the Configuration File

Most importantly, you should find the configuration.php file on your server. This can be done by using a file manager or an FTP client. For the steps below, we have chosen the former one. The example is made based on BlueHost cPanel as cPanel is the most widely used one in its kind.

Step 1: Log into cPanel and locate File Manager under the File Management section.

File Manager

Step 2: Click on File Manager, and select the root folder of the old domain of your Joomla site to open.

Select Directory

Step 3: In the long list of folders and files, find configuration.php.

configuration.php

Step 4: Make a backup of the file by right clicking and downloading the file to local computer, and then click on the link of Code Edit to open the file in a code editor.

Code Edit

Step 5: In the long lines of codes, locate the line in the following format.

public $live_site = 'example.com';

This line of code defines the current URL setting of your site, which means that "example.com" refers to your old domain. Now you only need to replace "example.com" with the new domain. Since things may be complicated if the codes are too long, you can press "CTRL + F" to find or even replace the code.

That's it. Do not forget to click on the Save button when you have changed the URL. After that, open a web browser to visit your site through the new domain. If everything is right, you do not need the tutorial below, but if the site fails to show up, you have to check and modify your database or even revert to the old configuration.php file.

Modify the Database Settings

This requires you to know a little about database and phpMyAdmin, but no technical skill is needed, so you do not need to worry about making changes. Just be careful enough when following the steps below.

Step 1: Log into cPanel and locate phpMyAdmin in the Database Tools section.

phpMyAdmin

Step 2: Open the database list by clicking on the Databases button in the upper left, and select the database that your site is using.

Step 3: In the top menu, click the Export tab. Then you need to define the format as "SQL", and click on the button saying "Go". You will get a file named "database-name.sql" downloaded to your local computer.

Export Database

Step 4: Open the SQL file locally with a text editor like Notepad++.

Step 5: Find your old domains in the file and replace all of them with the new domain. You may find it a little bit difficult because there are so many codes, but depending on the settings of the editor, you may press "CTRL + F" to open the find and replace dialogue which helps. You have to check through the whole file to make sure that all the old information has been updated. When you have accomplished the replacement, save the file.

Step 6: In phpMyAdmin, click on the Import tab in the menu for the Joomla database, and select the local SQL file to upload. After the importing is completed, you should be able to visit your Joomla site with the new domain.

Import Database

Remember that if you are not sure you can get everything right on your own, create a backup of the Joomla site before making any change, so that you won't ruin your site in any circumstance.

At last, you may need to create proper 301 redirects to tell search engines like Google that you have transferred from the old domain to a new domain name, or you can harm the existing search engine rankings of your site.