Quite often, some site owners realize that the domain name they picked and used for their Joomla website doesn’t cut it anymore, so they decide to change it and move their Joomla website to another (better) domain. In this guide, we provide step-by-step instructions on how to do that:
Step 1 – Move your Joomla website to another server: We have already discussed that before so we won’t discuss it here again. Just make sure you don’t delete any files/data from the old website until your Joomla website is fully moved and tested.
Step 2 – Replace all links in your website pointing to the old domain with equivalent links pointing to the new domain: Frequently when you write an article in Joomla, you tend to link to another article on your website – which is a good practice. However, when you decide to move to another domain, you will have to update these links to point to the new domain. This can be done in two ways:
- The slow and inefficient way: Where you will have to edit each article and update the links manually. This is OK if you have a few articles with links to your website in them, but when you have more, this can become a very tedious and long task (not to mention that it’s possible for you to forget about some links to your previous website, which will make the thing very messy).
-
The fast and efficient way: You can just update all the links with a simple REPLACE query issued on your jos_content table. Here’s the replace query:
UPDATE jos_content SET introtext =REPLACE(introtext, 'http://www.yourolddomain.com', 'http://www.yournewdomain.com'), fulltext =REPLACE(fulltext, 'http://www.yourolddomain.com', 'http://www.yournewdomain.com');
Step 3 – Tell search engines that you changed your domain
It is very normal that search engines (especially Google) will maintain an index of your old website and still point to it in their search queries. You need to tell Google (and other search engines) about the change, and the way to do it is to add the following code to your .htaccess file for your old domain:
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.yournewdomain.com/$1 [R=301,L]
You’re done!
If you’re having problems moving your Joomla website from one domain to another, then go ahead and contact us! We’re always here to help!
Thanks! I was looking for the command to change the old url in the database. This is the part most help sites leave out but extremely important on bigger sites. I also appreciate the htaccess update for search engines. Great article.
Hi 21stcn,
No problem! For those doing the URL change in the database, make sure you backup your database first!
I only moved to a new domain, using the same hosting.
I change the following line in “configuration.php” (found in Joomla directory)
public $live_site = ‘http://oldsite/’;
to
public $live_site = ‘http://newsite/’;
Also used your query, this was very useful!
Thank you & kind regards!
The problem I am having is moving from a subdomain of one Domain to a root Domain of another.
To create a new DB and DB user requires the prefix of the destination Domain which negates the old credentials. I cannot get it to connect to the new, imported DB but I CAN get it to connect to the old DB while running on the new Domain. When I switch the backend or frontend creds I can no longer connect and the site crashes.
Does that make sense?
Hi Jim,
It seems you have created the new database, but you have not given the proper permissions to the db user to access that database.