We’ll state right off the bat that frivolously changing your domain name – especially on an established WordPress website – is not recommended. However, there are legitimate reasons for doing so, and if the need arises you’ll want to get the job done correctly.

Fortunately, the process is actually surprisingly simple if you’re just changing the primary URL for your website. While you’ll need to alter some settings in two different locations, each will be a breeze to deal with.

This post will look at how to change your domain name within WordPress, and will also touch on some crucial pointers for doing so successfully. Let’s get started!

How Do You Change Your Domain Name?

As we said, changing your WordPress website’s domain name is not something you should do lightly. However, when you do find yourself in this situation, the process involves just a few steps:

  1. Access your WordPress dashboard, and change your URL within the Settings > General screen.
  2. Update your wp-config.php file to reflect the changes.
  3. Check that the domain change has been correctly implemented.

The process itself is relatively simple, although there are some aspects that require a little technical knowledge. We’ll cover those in the next few sections, but don’t worry – we’ll walk you through each step.

Changing Your Domain in WordPress

Before you dive headfirst into changing your website’s domain name, you’ll want to keep a few considerations in mind. A little preparation is essential, to make sure the process goes as smoothly as possible. One mistake could bring down your entire website, but getting your resources and knowledge in order before you begin helps you avoid that scenario.

For instance, you’ll want to make you have a full backup of your website in place before lifting a finger. That way, if the worst happens, you can roll back your changes to a clean configuration and start over.

Also, you’ll need to use a File Transfer Protocol (FTP) client for some of these steps. This is a way to access your server directly from your desktop, and although it’s simple to use, there is a learning curve involved. As such, you’ll want to download a suitable client (we recommend FileZilla) and brush up on your FTP skills.

In addition, you’re going to need your server credentials to log in via FTP. These can usually be found within your hosting provider’s admin panel.

Finally, we’re assuming that you already have a domain name purchased, and you’ve gotten it ready by pointing it to the correct nameservers. If not, you’ll want to make sure this is sorted out before you do anything else.

How to Change Your Domain Name

Now that the prep work is out of the way, let’s get down to business! Here are the three steps you’ll need to follow in order to change your WordPress site’s domain name.

Step 1: Change Your URL Within WordPress

Your first task is to physically change your site’s URL within WordPress. However, this step comes with a word of warning. Once you save your changes, your site’s back end won’t be accessible until you’ve completed the rest of this procedure.

To begin, log into WordPress, and navigate to the General > Settings screen:

Change Your URL Within WordPress

This screen contains global settings for your WordPress site. The fields we’re interested in are WordPress Address (URL) and Site Address (URL):

how to change your wordpress domai

To change your URL, simply type the new address into both of these fields, and click on Save Changes. As we mentioned, this will make your site temporarily inaccessible.

Step 2: Edit Your wp-config.php File

Before you can access your site again, you’ll need to update your wp-config.php file to reflect the changes you’ve made. This is another reason a full backup is vital before beginning this process.

Open up FileZilla (or whatever FTP client you prefer), and log in by entering your credentials into the HostUsernamePassword, and Port fields. Then, select Quickconnect:

Domain name change

At this point you’ll see two lists of folders. The ones on the right-hand side are most important, as those are on your server. First, you’ll need to find your website’s root folder, which is often called wwwor public_html, or is named after your site. Then look for the wp-config.php file within that folder.

This is one of WordPress’ core files, which dictates how your site works and how it connects to the web. To edit it, right-click on the file and choose View/Edit. This will open it in your text editor of choice:

how to change your domain name

Here, you’ll need to add two lines to the file, right before /* That’s all, stop editing! Happy blogging. */:

define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');

Of course, you should replace the placeholder URLs with your new address. Once you save your changes and upload the new version of the file back to your server, you should be able to access your site again, and your domain should be changed! However, your work is not quite done.

Step 3: Set Up Permanent Redirects and Notify Search Engines of the Change

This final step is more of a ‘clean-up’ job. Even once your domain is successfully changed, you’ll have a lot of links throughout your content and across the web that point back to your previous address. Fortunately, you can permanently redirect those links to your new domain.

To do this, you’ll need to once again access your site via FTP, and look for the .htaccess file. This is another WordPress configuration file (so it’s worth copying to your desktop as a backup before you tweak it). Within, you’ll want to add the following code:

#Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)$ http://www.example.COM/$1 [R=301,L]

Again, the placeholder URL should be changed reflect your new domain.

Once you’re done with that, the final task is to tell Google that you’ve updated your domain. The process is straightforward within Google Search Console, and will only take a few minutes.

error: Content is protected !!