How do I change the WordPress Site URL?

If needed, you may wish to change the domain name for your WordPress site.

You can use the following steps to ensure it's done properly, as there are a few important settings that must me made in order to make the switch.

Introduction

The following are instructions for moving a WordPress installation from one URL to a different one. There are two different cases for moving a WordPress install, as shown below. The first case shows a WP site move from a sub-directory to its parent domain. The second case shows a WP site move from one fully hosted domain to a different one.

If the domain will remain the same and the first case more closely matches what you wish to accomplish, then you can ignore the "Getting Started" section below and proceed to the Changing the base URL set in your WordPress settings section. If the second case more closely matches what you wish to accomplish, then begin with the Getting Started section.

Getting Started

Since WordPress only works properly on a domain that is Fully Hosted, you must make sure that the new domain you wish to move your site to is Fully Hosted in the DreamHost system. In the above example (Case 2), the site is moved from one domain to a completely new one.

Make sure that the new domain is:

  • fully hosted at DreamHost, and
  • fully hosted under the same FTP user as the old domain as it will make it easier when it comes to moving the WordPress files.

For more information on adding a hosting to a domain, see the Adding domains article.

Changing the base URL set 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.
  5. Save your changes
  6. Log out of your WP 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. Look for your wp_options table after selecting the appropriate database with which the WordPress installation is associated.
    03 Change wordpress site url phpmyadmin.fw.png
  3. Scroll to the wp_options row and select the first icon under the actions tab.
    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; which if unavailable due to errors, is a good alternative.

  4. Select the pencil option to the left.
    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.

Moving the actual WordPress files

You can use FTP, SFTP, or SSH to move your WordPress files. As mentioned previously, keeping the old domain and the new domain on the same user simplifies this process.

If you choose to use FTP or SFTP for example, you can move the files and folders within the server as your user has access to both domains.

Correcting any broken paths

Before you proceed, you should back up your database since the following changes may cause issues. For more information on how to backup up your database, visit the following article:

  1. Once you've moved the WordPress site’s files to the new domain’s web directory, check to see if you are able to view the site.
    • You may notice that the site appears broken, as if the CSS and media files are missing.
    • They are not missing, but the URLs are incorrect (assuming you properly moved the new data over to the new domain’s directory).
  2. Update the hardcoded URLs which are defined in the database.
  3. Use the following WordPress plugin which can help you update the URL paths that are experiencing problems:
  4. 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
  5. If the changes make sense to you, then run the above command again without the 'dry-run' call.

See also

Did this article answer your questions?

Article last updated .