How to Change WordPress Site URLs (Best Methods)!

Last modified: June 16, 2020
You are here:
Estimated reading time: 2 min

WordPress is a content management system that does not require any introduction. Millions of blogs and websites and stores are powered by WordPress. It is so huge that there are thousands of different cases that might require changes in the configuration of the website. One such case is the change in the domain name of the website. In this short guide, I will show you different methods to change WordPress site URLs.

By site URLs, I mean the WordPress address and the Site address. Both of them are same in the majority of the cases. Both of them are the base URLs of your WordPress site.

So, In this guide, I will show you three different methods to update the URLs of your WordPress websites. The three methods are:

  1. Change WordPress URLs from the Admin section
  2. Update URLs from wp-config.php
  3. Change WordPress URLs using WP-CLI

Let’s start our guide with the first and the easiest method to change WordPress site URLs.

Change WordPress Site URLs from the Admin section

This is the easiest method to change WordPress URLs. The first thing you have to do is to log in to the Admin section of your WordPress site. Once you are logged in, click on the Settings section from the left sidebar. On the General Settings page, you will see a bunch of fields for a bunch of information.

In that form, you will find two fields with (URL) in the label. Just like the following image.

Change WordPress Site URLs

Enter the new URLs in both of these fields and click on the Save Changes button given at the bottom of the settings page. Once done, you will be able to access your site on the new WordPress URLs.

Change URLs with wp-config.php

If you don’t want to change URLs from admin section or cannot change URLs from the admin section, don’t worry! You can actually set the URLs from wp-config.php file. So, Open up the file manager or FTP client and navigate to the WordPress installation directory.

Once you are there, Edit the wp-config.php file and add the following lines at the end of the file.

define('WP_HOME', 'https://newexample.com');
define('WP_SITEURL', 'https://newexample.com');

Now, Save the file and you will be able to access your WordPress site using the new URLs. Note that the values set in the wp-config.php file will override the URLs provided in the General settings page of WordPress.

Now, Let’s move on to the last method to change WordPress site URLs.

Change WordPress URLs using WP-CLI

WP-CLI is an awesome tool to manage all your WordPress instances using the command line interface. It is very easy to manage WordPress settings using WP-CLI. You can also set the site URLs using the WP-CLI tool.

It just takes two commands to update the URLs using this method. But to execute these commands, you have to connect to your server via SSH. If you are using Linux based operating system or Mac OS, open up the terminal and connect with your server via SSH directly. If you are using Windows, use Putty or Bitvise to connect with your server via SSH.

Once you are in, Execute the following commands to update the URLs of your WordPress site.

wp option update home 'https://newexample.com'
wp option update siteurl 'https://newexample.com'

So, that’s all it takes to update Site URLs using WP-CLI. If you want to install WP-CLI on Linux, you can follow our guide too!

 

Conclusion: There is one more method to update the WordPress site URLs. In that method, you will basically log in to the PHPMyAdmin and update the site URLs directly into the database. It is a little bit hard if you are facing this for the first time. But the above-given methods are the easiest and the best! Let us know in the comment section if you are facing any issue changing WordPress site URLs, we will respond back with the solution as soon as possible.

Was this article helpful?
Dislike 0
Views: 7