Stand with Ukraine. Fight for freedom and democracy

Donate
Back to contents

How to Change WordPress Website’s Address

Do you want to know how to change your WordPress website address? There are several reasons why you might have decided to edit your WordPress website URL. One of the most likely reasons is that you bought a new website domain. Other possible reasons include updating from HTTP to HTTPS or wanting to remove the “www” from your website’s URL.

There are several ways to change your WordPress site URL, and in this guide, we will walk you through three of them, starting with the easiest and most common method.

Table of Contents

  1. How to Change WordPress Site Urls From the Dashboard
  2. How to Edit WordPress Website Urls Using the functions.php File
  3. How to change WordPress Website Address Using wp-config.php File
  4. FAQ
  5. Summing Up

How to Change WordPress Site Urls From the Dashboard

The WordPress admin dashboard is the quickest and easiest way to change your WordPress site URLs. From the admin menu, go to Settings and select General. This is where you will be to update these two URLs:

  • WordPress Address (URL): Where your WordPress core files are stored.
  • Site Address (URL): The address visitors go to access your website.
edit wordpress address via dashboard setting

Usually, these two addresses should be the same. The only reason they would be different is if you have installed WordPress in its own directory. And the only reason you would do that is if you didn’t want WordPress to be the main platform for your website. 

Be careful to enter the correct URLs here. However, if you make a mistake, you can override it by editing the wp-config.php file, which we will discuss later.

NOTE
If you are unable to edit the URL settings because they are greyed out, this is probably due to some code in the wp-config.php file. If so, please see the section below titled how to change WordPress site address using wp-config.php file.

Once you have changed your URLs, you may have to clear your WordPress cache.

How to Edit WordPress Website Urls Using the functions.php File

If you cannot access your website’s WordPress admin dashboard, try this method. To do this, you will first need to connect to your website using an FTP client. 

Once you have connected via FTP, find your WordPress theme folder. This will likely be somewhere like /wp-content/themes/your-theme-folder/.

change wp site url in functions.php file

Open function.php in a text editor, for example, Notepad, and add this code at the bottom, replacing “https://yourwebsite.com” with the website’s actual URL:

update_option( 'siteurl', 'https://yourwebsite.com' );
update_option( 'home', 'https://yourwebsite.com' );

Once you have done that, please save the file and upload it to your website via FTP. Now, look at your website to ensure everything is fine. If it is, you can then remove those two lines of code from the functions.php file and upload it again.

By using this method, the URLs are updated in the website’s database. This is because WordPress updates all the URL’s in the database whenever the functions.php file is loaded. 

How to Change WordPress Website Address Using wp-config.php File

Another common method for changing the WordPress site address is editing the wp-config.php file. Any values in this file will override the settings in the WordPress admin screens. This is why the addresses can sometimes be greyed out. It means the wp-config.php is overriding it and preventing it from being edited. 

edit website address via wp-config.php file

By using an FTP client, as mentioned earlier, you should be able to find your wp-config.php file in the root directory of the WordPress website. Open the file in a text editor such as Notepad, and add these lines above the bit that says to stop editing, making sure to replace “http://yourwebsite.com” with your website’s actual address:

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

Save the file and upload it to your website. Then, when you view these settings via your WordPress dashboard, you should see them greyed out. You won’t be able to edit them without removing those two lines from wp-config.php. So, if you do want to be able to edit them from within the WordPress dashboard, remove those two lines, save the file, and upload it to your website.

FAQ

What is the URL of WordPress?

The URL of WordPress is the location where your website’s WordPress files and folders are saved. So, if your website address is http://yourwebsite.com, and you have installed WordPress in the root directory rather than its own subdomain or subdirectory, http://yourwebsite.com will be the URL of WordPress.

Why are my WordPress address and site address fields greyed out?

If the WordPress address and site address fields are greyed out, you’re being prevented from editing them due to code in the wp-config.php file. If you want to change these settings, please follow the instructions to change the WordPress Site address using wp-config.php file.

How can I recover WordPress after the settings’ URL address has changed?

Some users less familiar with WordPress might mistakenly change the WordPress Address and Site Address in the admin panel. To fix this, see how to edit WordPress website URLs using the functions.php file or change WordPress site address using the wp-config.php file above.

Is there a WordPress change URL plugin that can bulk update URLs in all blog posts, pages, and other content areas?

Yes, there is, and it’s called the Go Live Update Urls plugin. It is an excellent time-saver because it goes through your whole website and changes all instances of an old URL with the correct new URL. This plugin can be beneficial if you have just changed your website to a new domain.

Summing Up

Whatever your reason for wanting to change your WordPress URL, whether it’s because you have updated to HTTP or switched to a new domain, we have provided you with several methods. Of course, the quickest and easiest way is through the WordPress admin dashboard, but if that doesn’t work, you can do it by editing either the functions.php or wp-config.php files.

We hope you found this guide to changing the WordPress website address helpful.