1. Home
  2. WordPress & websites
  3. How do I change the domain name used by a WordPress installation?

How do I change the domain name used by a WordPress installation?

Before you go on with changing the domain name of a WordPress installation, you need to make sure that the new domain points towards the same installation as the old domain name. Otherwise, the website will stop working after the change.

Sometimes, you want to change the domain name used by a WordPress installation, e.g. if you’ve developed a new website using a temporary domain and now want to publish the site on the correct one. This guide details what you need to consider before changing the domain name.

Preparations

Before you change the domain name used by your WordPress installation, there a few things to check and consider:

  1. If the domain you’re about to change to isn’t added to your web hosting account already, this needs to be done. Add it as an addon domain, and ensure that you set the same document root for the new domain as is currently being used by the site’s old domain. If the old domain is the main domain of the account, or is added as an alias, the document root will be public_html. If the old domain is an addon domain, you can see what the document root is on the same page as where you can change it.
  2. If the new domain is already added to your web hosting account, you have to make sure that it uses the same document root as the old domain name. If the old domain is the main domain of the account, or is added as an alias, the document root will be public_html. If the domain is added as an addon domain, you can see the document root on the same page as where you can change it.
  3. Make sure that the new domain is pointed towards the same IP address as the old domain. You can see where the domain points using e.g. mxtoolbox.com.
  4. If both domains point at the same IP address you’re done with the preparations. If the new domain name points at a different IP address, you need to edit it so it points towards the same IP address as the old domain. If the new domain has its DNS management with us, you can edit it via cPanel.

Before you proceed, we recommend that you back up your database. Should something go wrong, you can always restore it to return everything to how it was before you started.

Changing the URL using WP-CLI

Now it’s time to change the domain name used by your WordPress site. All instances of the old domain name need to be replaced in the database, and while it can be done via phpMyAdmin we recommend that you use WP-CLI for the operation. WP-CLI is a tool that’s available via the terminal through cPanel, and also via SSH.

We have an entire guide dedicated to WP-CLI, and you can find it here.

Was this article helpful?

Related Articles