Maybe you found a better domain name or you have set up with a temporary domain which you want to change now, or you are migrating your website from “HTTP to HTTPS.” Don’t worry I will show simple step by step process to change domain name of WordPress website.
To change the domain name of a website. You need the login credentials of your WordPress administrator, cPanel and FTP and access to PHPmyAdmin through your cPanel.
Before proceeding, create a complete backup of your website.
Here I will explain to change a domain name through two options. First one is very easy, but if you are unable to change the domain for any reason, then you can try the next option.
-
Change the WordPress URL through Admin Dashboard
From the admin dashboard, you can change your WordPress URL. Open Admin Dashboard, and on the left side, there will be an option “settings.” Take cursor over there, and many options will appear. Click on “General,” and there you will find two options.
WordPress Address (URL): The address to reach the blog.
Site Address (URL): The address of WordPress core files.
Both should match, except you are providing WordPress with its directory. Remember that your WordPress dashboard can only be accessed via the new URL after you click on “Save Changes.”
-
Change the WordPress URL in wp-config.php File.
The second way to change a URL is through WP-config.php. It is worth noting that wp-config.php values override method one settings. Sometimes you cannot change URL through this process as files are hard-coded which makes fields not editable.
Located at the root of your WordPress site (wp-config.php) can be accessed via SSH, FTP or WP-CLI. To hard-code WP_HOME and WP_SITEURL, enter the following code towards the top of the file, modifying the values to reflect your domain.
define('WP_HOME','https://yourdomain.com'); define('WP_SITEURL','https://yourdomain.com');