How to Move a Joomla Website to Another Domain

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!

9 Responses to “How to Move a Joomla Website to Another Domain”
  1. Comment by 21stcn — May 3, 2012 @ 8:06 am

    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.

  2. Comment by Fadi — May 3, 2012 @ 10:05 am

    Hi 21stcn,

    No problem! For those doing the URL change in the database, make sure you backup your database first!

  3. Comment by Alwyn — June 28, 2012 @ 5:48 am

    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! :)

  4. Comment by Jim — May 6, 2013 @ 8:55 pm

    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?

  5. Comment by Fadi — May 6, 2013 @ 9:33 pm

    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.

  6. Comment by Ronnie — December 29, 2014 @ 12:48 pm

    Hello,

    Thanks for this wonderful article. But my big question is that how do I make already installed extensions work without installing again especially when moving from one domain to another? Because I paid for an extension and would like it to be reinstalled to the new domain without paying again.

    I will be happy to hear from you soon

    Thank you
    Ronnie

  7. Comment by Fadi — December 29, 2014 @ 10:47 pm

    Hi Ronnie,

    You should check with the developers of the extensions that you have purchased for your old domain whether they allow you to move them to another domain (e.g. whether the license covers a specific domain, one domain, or all domains).

  8. Comment by Rob — July 4, 2015 @ 12:10 pm

    Hi,
    Thanks for the great guide!

    I’ve just moved my site and trying to replace all the URLs. I ran the string above in MySQL database under the query tab but I guess it doesn’t work with K2 items.

    I am wondering if you have any idea how could I replace the links in K2 articles?

    Thanks!
    Rob

  9. Comment by Fadi — July 23, 2015 @ 9:37 pm

    Hi Rob,

    Try the following query:

    UPDATE #__k2_items SET introtext =REPLACE(introtext, 'http://www.yourolddomain.com', 'http://www.yournewdomain.com'), fulltext =REPLACE(fulltext, 'http://www.yourolddomain.com', 'http://www.yournewdomain.com');

    Replace, in the above query #__ with your database prefix (also referred to as table alias or database alias). You can find your database prefix in the configuration.php file and it’s the value of the variable $dbprefix. On old Joomla websites the database prefix is something like jos_.

Leave a comment