The WordPress Site URL and Home URL settings need to be checked when migrating websites to another server or subdirectory. In some cases, the actual WordPress file path shouldn’t be the same as the website address typed in web browsers.
WordPress Address (URL) (Site URL): absolute file path to your WordPress core files. For example, domain.com/wordpress could be ~/public_html/wordpress or /var/www/html/wordpress.
Site Address (URL) (Home): web address to reach your WordPress site.
Below we’ll cover multiple ways to update this information.
Update the WordPress Site URL and Home URL in WordPress
Using the WordPress Dashboard
This is the easiest method.
- Log into WordPress.
- On the left, select “Settings” and “General.”
- Edit the WordPress Address (URL) / Site URL and Site Address (URL) / Home as necessary.
- At the bottom select “Save Changes.”
This method is helpful when current settings prevent you from accessing the dashboard. Note that it prevents you from making changes to the URLs in the WordPress dashboard.
- Log into your server via SSH, FTP, or other server management software.
- Navigate to your WordPress root directory.
- Edit the wp-config.php file.
- Add the following above the MySQL settings, replacing the URLs as necessary:
- Save changes.
If you’re unable to access your WordPress dashboard, you can add the following line near the top of your wp-config.php file to auto-configure the site URL and regain access:
Third Party Software
MySQL Database Updates with phpMyAdmin
cPanel servers include phpMyAdmin which can be used to edit MySQL databases. We recommend backing up your database beforehand.
- Log into phpMyAdmin.
- Select your WordPress database on the left. The format will usually be “serveruser-wpXXX.”
- The selection will expand to list database tables. Select the table with the suffix “_options.”
- Double-click on the URL in the “siteurl” and “home” rows to make changes. Changes are saved automatically.
WP-CLI Terminal Application
Advanced users with Secure Shell (SSH) access can use WP-CLI to make updates. Some hosting providers include WP-CLI by default.
- Log into SSH.
- Navigate (cd) to your WordPress root directory.
- Ensure you’re in the correct WordPress directory:
wp option get siteurl && wp option get home
- Update the site URL:
wp option update siteurl https://newsite.com
- Update the home URL:
wp option update home https://newsite.com