How to change the domain name on WordPress

How to change the domain name on WordPress

There have been many inquiries from users who are unhappy with their url and site addresses and want to know how to change the domain name on WordPress.

This article will offer step-by-step instructions on how to change to a new domain name on any WordPress website.

Seasoned developers can readily change their site address, but it’s a fundamental skill that will benefit all users.

Though changing to a new domain name on WordPress-powered sites is a common request, nevertheless it can potentially damage the internet presence you’ve worked hard to build.

So while change is good, be cautious if you own an already well-established WordPress website.

Reasons For a New Domain Name

There are many legitimate reasons for a new domain. Many projects will have to go under a new name and that means a new site address to match. Two of the most common scenarios are:

Rebranding: You can rebuild your company’s image from the ground up and a new domain name will broadcast your improved look to the world.

You’ve probably visited the old domain name called twttr, but everybody has accessed Twitter. The successful rebranding of prominent domains like this shows that change can be good.

Domain Extension Change: In some cases, your project may be running on a subdomain like or you may be using an extension like .mobi or .shop. These site addresses might not be resonating well with your audience.

Swapping to a different extension or new site address URL can breathe new life into your WordPress domain and make it even easier to reach a wider audience.

What To Know Before You Create A New Domain Name

Changing your WordPress domain name is simple, but there will be the occasional need to adjust your website’s PHP code. This code is essential to the operation of your website and mistakes made there could bring your domain to a halt. Some quick prep work before you start will guarantee the process goes smoothly.

  • Before doing anything, create a full backup of your website. Do this either manually by exporting your database or by using one of many backup plugins. Some reliable options are Updraftplus, BlogVault, and VaultPress.

  • Buy and Register your new Domain name by pointing it to the correct name servers.

  • Have a File Transfer Protocol (FTP) client. The FTP will allow you to access your server directly from your computer. They’re easy to use, but be prepared for some learning curve. We recommend FileZilla, a great FTP for beginners to brush up their FTP skills.

  • Head to Hostinger’s Domain Checker and type in your preferred new domain name. The checker will tell you if that option is available and it will offer some alternative suggestions in case that domain is already taken.

How to Change The Domain Name On WordPress

To make use of your new domain, add it to your hosting through the cPanel.

  • In the cPanel click on the Addon Domain
  • Enter your new domain address, subdomain, and document root.

  • Click Add Domain.
  • Either download your backup file or directly copy your previous folder to the new domain folder.
  • If you’re migrating to a new hosting service follow these instructions to download your backup and add it to your FTP using your cPanel.

    • Inside the cPanel go to your Dashboard > Settings > General.
    • Replace your current WordPress Address (the URL used to visit your site) and Site Address (the URL of your core files) with your new domain.
    • Hit Save Changes to finish.
  • Open your new domain folder.
  • Edit the wp-config.php file and define the site URL and homepage for your new domain. This will reflect the changes you’ve made in the WordPress settings. Access your wp-config.php file from the cPanel file manager or by using FileZilla.

    • Go to cPanel > Files > File Manager
    • Choose the domain and click Go To File Manager

    • Locate the wp-config.php file in the public_html folder
    • Right-click and select Edit
    • In the following snippet, replace with your new WordPress domain name, then insert it into the file and press Save & Close.

You can use the following code:

define('WP_SITEURL', '');

define('WP_HOME', '');

Setup a Permanent 301 Redirect

Now that you’ve successfully changed to your new WordPress domain name, but what if someone visits the old one? Will they just see a blank page? You don’t want to lose even a single visitor. We recommend keeping your old domain active for a while to allow users and search engines time to recognize your new home.

But that’s only a temporary solution. The long term fix to guarantee that no traffic gets lost during your rebranding efforts will be to set up a permanent 301 redirect from your old domain to the new. This will help you optimize your website for search engines and users alike by redirecting anyone who lands on your old website, sending them instead to your new one. Here’s how:

  • Log into your cPanel
  • Click on the File Manager
  • Open your website folder.
  • Go to the .htaccess file and click on Edit.
  • Go to cPanel > Files > File Manager
  • Select your old domain and click Go to File Manager.
  • Find the .htaccess file in the public_html directory and right click it

  • Select Edit
  • Insert the following code, after replacing with your new domain, then press Save & Close.

If you need to put the code in the wp-config file to change the site address or domain name, do the following:

  1. Log into your WordPress Admin Dashboard
  2. Navigate to Settings > General
  3. Under general settings find two fields named WordPress Address URL and Site Address (URL)
  4. Change the old domain name to the new one
  5. Click Save Changes to finish the process.

Reviewing How to Change the Domain Name on WordPress

Changing your WordPress domain name is a common problem, but the built in solutions offered for your WordPress site mean it is achievable. In this tutorial you’ve learned how to manually tweak the URL address settings and PHP code through a file manager or FTP client to cleanly change your domain.

Here’s a quick recap:

  1. Perform a full website backup
  2. Purchase and register a new domain
  3. Add the new domain name and restore the site’s backup
  4. Change website address in WordPress settings
  5. Update wp-config.php file
  6. Update site database
  7. Redirect visitors and search engines to your new domain.

Seven steps is all it takes to learn how to change the domain name on your WordPress site, but there are many other tools and features to master on WordPress. Our many other guides will make you an expert on all things WordPress.

If you enjoyed reading this article on how to change the domain name on WordPress, you should check out this one about how to hide the author in WordPress.

We also wrote about a few related subjects like creating a comparison table with WordPress plugins, how to scan the WordPress database for malware, how to upload an HTML file in WordPresswhere are WordPress pages stored, and how to delete WordPress themes.

Up Next:

How to Add Social Media Icons to the WordPress Footer

How to Add Social Media Icons to the WordPress Footer