Your WordPress address and site address (or URL) are very important as they reference both the address of your site on the web and the location of your site’s files and admin screens.

There are many reasons why you might need or want to change your WordPress URL. Perhaps you’re changing domains, moving to a subdomain, updating from www to non-www, moving files around, or even migrating from HTTP to HTTPS.

Whatever the case may be, there are a few options you have when it comes to changing the URL, some more advanced than others.

In this guide, we’ll show you the different methods you can use to change the URL of your WordPress installation and your WordPress site URL, which are two different things.

Prefer to watch the video version?

Change WordPress URL via the Admin Dashboard

The first and most common method is to change your WordPress URL directly from within the admin dashboard. In the admin menu, go to Settings > General to access the general settings screen. You can then update the following:

  • WordPress Address (URL): The address to reach your site.
  •  Site Address (URL): The address of your WordPress core files.
General settings - WordPress URL
General settings – WordPress URL

Both should match unless you are giving WordPress its own directory. Remember that after you click Save Changes, your WordPress dashboard is now only accessible via the new URL. So be sure to check that you’ve entered the right URL.

If you do accidentally enter the wrong URL, you can override the settings in the admin screens by editing your wp-config.php file (was see the next method below).

Note: If the fields above are grayed out, it is most likely because you already have hard-coded values in your wp-config.php file. In which case, jump to the next method.

If you’re creating a fresh WordPress installation on Kinsta hosting, you will be given a temporary URL, such as sitename.kinsta.cloud. You can use the directions above to update the address.

You might also need to clear your WordPress cache after updating the URLs, otherwise you might receive a redirect error. If you’re a Kinsta client, you can clear your cache from the MyKinsta dashboard under the Tools section for your site.

MyKinsta - clear cache
MyKinsta – clear cache

Change WordPress URL in wp-config.php File

The second most common way to change your WordPress URL is in your wp-config.php file. It is important to note that values in wp-config.php override the settings in your WordPress admin screens.

If the fields aren’t editable (as seen below), it is most likely because they are hard-coded in this file.

WordPress change URL - General settings URL grayed out
General settings URL grayed out

The wp-config.php file is typically located in the root directory of your WordPress site and can be accessed via FTP, SSH, or WP-CLI.

In your wp-config.php file, add these two lines somewhere above the line that tells you to stop editing:

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

Save your wp-config.php file and close it.

When you go to the General settings screen in your WordPress admin, you’ll see that those two fields are now grayed out. You can’t edit them unless you remove those two lines from wp-config.php.

If you want access to those settings in your dashboard again, all you need to do is remove them from your wp-config.php file.

Change WordPress URL Directly in Database

A third method you can use to change your WordPress URL is directly in the WordPress database. To do this, you use phpMyAdmin (which is accessible from your MyKinsta dashboard). This is usually done as a last resort.

Accessing phpMyAdmin in MyKinsta
Accessing phpMyAdmin in MyKinsta

In phpMyAdmin, click on your database on the left-hand side. Then scroll down and click on the “wp_options” table. If your database has a different prefix it might be named slightly differently, such as wp56_options.

phpMyAdmin - wp_options table
phpMyAdmin – wp_options table

Then find the site url and home fields. Double click in the option_value field for each and type in the new URL.

WordPress change URL - phpMyAdmin
phpMyAdmin – editing URL

Your changes will automatically be saved.

Change WordPress URL With WP-CLI

A fourth option is to use the WordPress Command Line Interface (WP-CLI) to access your site and edit the URL.

You’ll need SSH access to your site (which is provided to all Kinsta customers) and you’ll need to be familiar with the process for accessing your site using WP-CLI.

If you are unfamiliar with WP-CLI you can check out our in-depth post on managing WordPress from the terminal.

The commands to edit your URL are as follows:

wp option update home 'http://yoursiteurl.com'
wp option update siteurl 'http://yoursiteurl.com'

Change WordPress Login URL

Sometimes you might want to change the URL for your WordPress login but not for the live site.

Your login URL is normally your domain name followed by /wp-admin or /wp-login. But it’s possible to change it to something simpler to provide a better user experience for your users and clients or to brand your site admin and remove obvious reference to WordPress.

You can change the WordPress login URL manually or by installing a plugin.

Redirection After Changing WordPress Urls

After you change your WordPress URLs, you need to make sure that anyone using the old URL is redirected to the new URL and doesn’t get an error.

If you’re with Kinsta, you can set up redirection using MyKinsta. Follow our knowledgebase guide to redirection to learn how to do it and read our guide to redirect best practices to avoid redirect errors like ‘too many redirects‘ and find out how to set it up so it doesn’t impact your site’s performance.

myKinsta redirection
Creating wildcard redirects in MyKinsta

You might also need to add redirects for individual posts or pages, although wildcard redirection is more likely.

If you’re not with Kinsta, find out if your hosting provider lets you set up wildcard redirection in your control panel.

Alternatively, you could use a plugin like Redirection to set up a wildcard redirection from your old domain name to your new one.

If you’re running Yoast premium on your site and you need to edit the URL of individual posts or pages, the plugin will automatically set up redirects for you, so you don’t need to do this manually. It also allows you to set up Regex redirects which you can use when you change your site URL, if you know what you’re doing. Our in-depth guide to redirects explains how Regex redirects work.

Summary

If you need to change your WordPress URL because you’ve switched domains or you’re transferring to HTTPS, you have a number of methods you can use to do it.

You can change the settings in the WordPress admin, hardcode them in your wp-config.php file, edit the database, or use WP-CLI. Work through the methods above to find the one that works for your site, and you’ll have your new WordPress URL working in no time.