How do I change the WordPress Site URL?

You can change the domain name for your WordPress site any time you like, but there are a few important settings that must me made in order to make the switch.

Make sure to carefully follow the steps below to ensure it's done properly.

Several reasons to change the URL

The following are instructions for moving a WordPress installation from one URL to a different one. There are different cases for moving a WordPress install, as shown below.

Case #1 — Moving from a subdirectory

The first case is when a WordPress site moves from a sub-directory to its parent domain. For example:

Case #2 — Adding or removing www

Another reason to update your URLs is if you need to add or remove www from your domain. For example, if you're using 'Cloudflare' with DreamHost, you need to add www to your domain. So if it was previously example.com, you would change it to www.example.com.

You may also see a browser redirect error when viewing your site. It may say "Too many redirects" or "The page isn't redirecting properly".

Case #3 — Adding 'https' to the URL

If you're using an SSL certificate, the first part of the URL changes from 'http' to 'https'.

Case #4 — Moving to a new domain

The last case is when a WordPress site moves from one fully hosted domain to a different one. For example:

If this option applies to your site, view the following article for full instructions on moving a WordPress install to a different domain

Two ways to change the WordPress URL

Changing the base URL in your WordPress settings

WordPress relies heavily on a base URL in order to properly load your media, pages, and so on. Since you are moving the WordPress site to a different URL, you also must update the base URL set within your WordPress site's settings in order to reflect the URL changes.

  1. Log into your WordPress Dashboard.
    01 Change wordpress site url.fw.png
  2. Navigate over to Settings > General.
  3. Locate the "WordPress Address (URL)" and "Site Address (URL)", and then write down the EXACT URL listed for "WordPress Address (URL)" which you will use later.
    02 Change wordpress site url in the dashboard.fw.png
  4. Change the URL for both "WordPress Address (URL)" and "Site Address (URL)" to its new URL.

    NOTE: This will cause your site not to load until you finish the remaining steps.

  5. Save your changes
  6. Log out of your WordPress dashboard and close your browser's window, but do not attempt to load the site just yet.

Changing the base URL using phpMyAdmin

If you cannot access the WordPress site through your user, you can instead use phpMyAdmin to update the URL.

Visit the following article for more information on how to log into phpMyAdmin:

  1. Open phpMyAdmin.
  2. Click your database in the left pane. Several tables appear below it. Click on your wp_options table.
    03 Change wordpress site url phpmyadmin.fw.png
  3. Locate the 'siteurl' and 'home' rows. Click the pencil icon next to each to edit.
    When you scroll over these options, "browse" will appear.
    04 Change wordpress site url phpmyadmin.fw.png

    The two options, the 'siteurl' and 'home', determine the WordPress URL and have the same affect as making the changes in the General Settings area of WordPress area.

  4. Click the pencil icon next to each to edit.
    04.5 Change wordpress site url phpmyadmin.fw.png
  5. Alter the URL by typing in a new one.
  6. Click the Go button to save the settings. Do this for both the 'siteurl' and 'home' options.

Correcting all other URLs in the database

WordPress hardcodes the site's domain name into the database in such things as image and link urls. This is a problem because when you click on a link on your new site, it redirects back to the old site. To change these, you can use a search and replace the plugin. Below are a couple of plugins that work:

If you are familiar with the command line, run the following command for the same effect (assuming you saved the old WordPress address):

[server]$ wp search-replace http://example.com http://new.example.com --dry-run

The --dry-run call at the end tests the address

If the changes make sense to you, then run the above command again without the 'dry-run' call.

At this point, your website should load normally on the new domain name.

See also

Did this article answer your questions?

Article last updated .