How to change WordPress domain address

Write a post on WordPress
Write a post on WordPress / Fikret tozak / Unsplash

You might have heard that changing the WordPress domain is very difficult. Or that it’s dangerous and you should never do it. Both aren’t true. There are situations where a change of a domain name can be justified – and the actual change takes just a few clicks. The problem is that if changing the URL and hitting “Save” is just one part of the job.


Disclosure: This is a guest post and the author’s views here do not necessarily reflect those of the blog owner.

There are quite a few steps you need to take both before and after to make sure you don’t wreck your site! In this post, I’ll guide you through all the steps. But first…

See also how to change WordPress username and password via cPanel.


Why would you ever want to change your domain name?

Rule number one of domain name change: if it ain’t broke, don’t fix it.

If you have a popular live site with lots of traffic, then think very hard before changing anything. However, do consider a change if:

1) A much better domain name has become available – something very relevant to what you do.

Nowadays you can choose among hundreds of industry-specific domains, such as .travel, .finance, etc.

Let’s say you have a site called

Wouldn’t sound better?

2) You are involved or risk getting involved in a copyright litigation. This can happen if your business name is already trademarked by someone else.


Preparatory steps

Change domain address

As I’ve said, changing the URL of your site in WordPress takes literally 10 seconds.

But if you only do that and nothing else, your risk losing traffic, hurting your rankings, and even breaking your site.

So proceed with caution and don’t skip steps.

1. Purchase your new domain and point it to your site

As soon as the domain you like becomes available, snatch it – even if you don’t plan to change the name of your WordPress site just yet.

You’ll need to get the DNS addresses from your hosting provider and enter them on the registrar site. You can find a detailed guide here.

In this guide, I assume that you are only changing your domain name, not the web hosting provider. If you want to change both, there will be additional steps involved.

2. Inform your customers/users

A sudden domain name change can confuse your audience (if your site is already live). Once you’ve bought the domain, you can start sending out regular newsletters about the upcoming change.

Important! Don’t tell anybody until you’ve purchased the domain. Otherwise, someone might snatch it first and hold it hostage until you pay them extra. It’s called domain squatting.

3. Backup your site

Don’t ever, ever touch anything on a live WordPress site without backing up first!

The easiest way to do it is with a free backup plugin, such as Blogvault, UpdraftPlus, or Vaultpress.

Here I’ll use UpdraftPlus as an example, but they are all very similar.

Basically you need to choose where to store your backups (Google Drive, Dropbox, etc.) in the settings tab of the plugin:

UpdraftPlus settings

Then go back to the main plugin tab (For UpdraftPlus it’s Backup/Restore) and hit Backup Now. The backup process takes a couple of minutes.

UpdraftPlus Backup/Restore settings

Finally, check in the destination folder to verify that your backup is there.

4. Install an FTP client or the WP File Manager plugin

Most serious WP developers use FTP clients – programs that allows you to edit and upload files to WordPress. Popular free clients include FileZilla, SmartFTP, and CyberDuck. Such a client will definitely work for you even when nothing else will. They take a little bit of setting up, though – a good tutorial can be found here.

An easier way is to use special WP plugins such as WP File Manager. In this guide, I assume that you’ll use a plugin. But make sure to uninstall it once you’re finished if you have more than one user with access to the WP panel.

Remember! Any incorrect changes made to core WP files can stop your site from working.


Changing your domain address

Now that you have your new domain and your site is backed up, you can finally change the URL.

There are two main ways to do it in WordPress:

No. 1 – the easiest – works for the vast majority of people, so try it first.
If it doesn’t work, proceed to method no. 2.

Method no. 1 – Change domain address in WP cPanel

The “official” WordPress way to change domain address is so simple it’s almost embarrassing.

In your WP admin panel, navigate to Settings → General.

Once there, you’ll need to enter your new site address in the fields WordPress Address (URL) and Site Address (URL):

WordPress General Settings

Click on “Save” – that’s it. Easy, right?

Note that from the moment you save the changes, your site will become inaccessible at its old address!

Method no. 2 – Edit the wp-config.php file

For some sites, you can’t change the URL in Settings → General: the addresses there are greyed out. It means that the URLs are hard-coded into the file wp-config.php.

So you’ll need to edit them there.

Wp-config.php Is a core WordPress file with key database information about your site.

If something goes wrong with wp-config.php, your site won’t work. This is the main reason we backed everything up first. You can see what a sample wp-config.php looks like here.

In the WP File Manager plugin, you’ll need to locate the wp-config.php file. It will be in the root directory of your site, often called public_html or wp_includes.

WP FIle Manager

Once you’ve found the file, download it and then open it with any text editor, such as Notepad.

Navigate towards the end of the file and add the following two lines of code:

define('WP_SITEURL', 'http://yournewURL');
define('WP_HOME', 'http://yournewURL'); 

Don’t forget to replace the yournewURL with your new domain address.

Save the changes and use the plugin’s upload feature to send the new version of the file back to the WP server. Now you should be able to access your site at the new address.

The main part is done!

Note that after you change the URL, you’ll need to login to the WP admin dashboard for the new domain.


The clean-up

Your site already lives at its new address, but there’s still some final redecoration left to do.

You see, you still have tons of links around your site and all across the web that point to the old domain name. You have to make sure they redirect users to your new site.

Many pages and posts on your site probably link to each other. So you’ll need all those links to contain your new domain name. Of course, you shouldn’t try to do this manually – there can be hundreds of links scattered around.

The easiest way is to install a plugin like Real-Time Find and Replace or Velvet Blues Update URL.

You’ll find the activated plugin under Tools in your WP dashboard. Replacing links is super simple: just enter your old and new domain names and hit Run.

Better Search Replace

Even though I include this step in the clean-up section, it’s actually vital. If you don’t change your permalinks, all the link building you’ve done in the past will be in vain. ALL backlinks to your site will be broken, and you’ll lose your search engine ranking, as well as tons of traffic.

Another name for this process is setting 301 redirects.

Back up your site first. Next, in the File Manager plugin, find and open the file called .htaccess and add the following code:

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

Save the file and upload it back to WordPress. Done!


The bottom line

As you can see, changing the URL of your site is actually the quickest and easiest part of the process. It’s normal for the whole process to take a few hours.

If you’ve followed all the steps, you should now have a perfectly working WP site at a new domain address. You might see a small decrease in your SEO traffic at first, but it’s completely normal.

Search engines need time to index all pages on your new site.

By the way, you should keep your old domain for at least 1 year and preferably as long as you can. This is to make sure that you don’t lose any traffic coming from those backlinks.

This is a guest post by Natalia Diatko.

Natalia Diatko

Natalia Diatko is using advanced technologies and finding new business tactics makes her feel happy. Finally, she highlights new trends. To read her latest posts, please, follow her on LinkedIn. She spends her free time reading psychology books and combing her cat’s whiskers.

Resources used:

Drop me a line in the comment below if you have anything to say.


Let me know your thought

Notify of
Inline Feedbacks
View all comments
Barzrul Tech uses cookies to ensure you get the best experience while browsing the site.Read more >>