Change Domain Name in WordPress – The Best Methods
WordPress domain name provides a means of finding and identifying a site on the web. Think of it as an ID you use at work; it’s what others use to identify you. As such, changing a domain name in WordPress – or in simpler terms, site address – of your website is a delicate issue. Delicate because if not done correctly, things could go wrong.
Many webmasters have reported that their websites crashed, lost functionality, and in some cases were hacked when they changed their domain names.
Nevertheless, there are times when you’ll need to change your WordPress site URL (domain name).
For instance, when you are looking to rebrand your business, you might have to change your website address to reflect the new business name. Or perhaps, you wish to move your site from HTTP to HTTPS.
These are just a few of the many circumstances that can cause you to change your URL.
The good news is, whatever the reason for wanting to change your site’s domain name, there are ways you could do it without compromising the integrity of your site.
In this article, we will show you how to change your WordPress address URL. So stick around.
Domain Name, Site URL, and Site Address: What’s the Difference?
Often times, people use domain name, site URL, and address interchangeably. In fact, if you noticed, in the introductory part of this article, we interchanged the terms at different points.
Does it mean the three terms all mean the same thing? Not exactly.
A domain is basically the address where your website lives on the internet. Now, your website may have several pages, posts, and files, it can only have one domain name.
Think of your office address, for instance. The building might have different floors and rooms with unique IDs (e.g. floor 2, room 302), it can only have one address (e.g. 10 Dow Jones Street, California).
A URL, on the other hand, is the address/path to a specific page, post, or file on the internet. With the office example we used above, it’s more like the address to a particular room in the office building.
For instance, take a look at this post on our blog: In this post, we explained how to perform a WordPress domain transfer from HTTP to HTTPS, by installing an SSL certificate.
The URL to this post can be seen highlighted at the very top of the page, and it reads:
If you copy this link to your web browser, you will specifically be taken to this post. Not the home page of the site or another page, but the post.
Lastly, the site address is a generic name used to either refer to the domain name of a website, or a URL within the site.
With that said, let’s now see some of the techniques you can use for changing your domain name.
How to Change Domain Name in WordPress
There are a number of methods for changing the URL address of a website. However, we will only be considering three of them.
Namely: via the WordPress dashboard, via FTP client or cPanel, and then via WordPress database.
Side Note: Having a recent backup of your entire website is a good practice. It will save you from losing data. We have compiled a list of the best WordPress Backup Plugins on the market, check it out.
Via WordPress Dashboard
The admin dashboard of WordPress can be considered as the central command unit of WordPress. You can alter, tweak, and change your WordPress websites via the admin dashboard.
To get started, log into your WordPress admin area. Navigate to Settings >> General Settings.
On the next page, you will see a WordPress Address URL and Site Address URL block.
In both blocks, replace the old site address with the new one you intend to use. Ensure both fields match each other.
Note: The http(s):// part should be included in both settings. A trailing slash (/) should not be at the end.
When you are done, scroll down and Save Changes.
To avoid redirect errors after changing the URL to your website, clear your website’s cache.
Change Domain Name Through FTP Client or cPanel
One of the easy methods to change your domain address is by making edits to the wp-config.php file. As a matter of fact, this technique can override whatever changes you might have made via your WordPress admin dashboard.
But since this file lives on your server, you have to access it through FTP using FileZilla (an FTP client) Or through your cPanel.
Once you have accessed the file, open it with a text editor of your choice.
If FTP seems to be so much of a work, you can use the cPanel.
To begin with, log into cPanel with your login credentials, then click on File Manager.
After that, scroll down to public_html in the domain folder. Double click on it.
On the next page, upon scrolling down you will find the wp-config file.
Right-click on it and click Edit.
Copy and paste the following code into the file, preferable toward the end of the page.
With the code copied and pasted, Save Changes to the document and exit. But that’s not all; you still need to set up redirects.
Setting up redirects properly ensures that anyone that tries to access your website via the old URL will be redirected to the new one.
To do this, access and open your website’s htaccess file.
Then paste the following code into it.
#Options +FollowSymLinks RewriteEngine on RewriteRule ^(.*)$ https://www.mynewdomain.COM/$1 [R=301,L]
Like we did previously, replace mynewdomain.com with your new domain name.
These few lines of code will configure WordPress to redirect links appropriately.
Change Domain Name Via WordPress Database
The last technique we shall be considering is via the database.
To begin with, log into your cPanel account and navigate to phpMyAdmin.
With the database page open, on the left-hand pane, click the + button right in front of your database name.
A drop-down list will appear. Click on wp_options (note that your database may have a prefix other than wp_).
Then edit the siteurl and home rows.
Here, paste in your new domain URL. Then, click Go
And that’s all for this method.
Changing the site address URL of WordPress websites or blogs is a risky adventure. Avoid it, if you can.
However, certain circumstances can warrant the need for you to change your site address. We discussed a couple of them here.
Whenever you find yourself needing to change your website address URL, endeavor to follow the techniques we shared here.
That way, the risk of your entire site coming down is minimized.
- How to Block IP Address in WordPress(Opens in a new browser tab)