How to change your WordPress site URL

Change WordPress’s address safely: in settings, in wp-config.php when you’re locked out, and in the database after moving domain or switching to HTTPS.

Guide2 min readLast updated
On this page
  1. Method 1: in settings
  2. Method 2: wp-config.php (when locked out)
  3. Method 3: phpMyAdmin
  4. After changing domain or moving to HTTPS
  5. If it doesn’t work
  6. Common questions

WordPress stores its own address in two settings: WordPress Address (siteurl) and Site Address (home). Get them wrong and you can be redirected away from your own site.

Method 1: in settings

If you can log in: Settings → General, change both addresses, save.

Method 2: wp-config.php (when locked out)

  1. Open System Info & Files › File Manager and edit wp-config.php in the WordPress folder.
  2. Above the line /* That's all, stop editing! */, add:
define('WP_HOME', 'https://yourdomain.co.uk');
define('WP_SITEURL', 'https://yourdomain.co.uk');
  1. Save and reload the site.

These override the database values. Once you can log in, you can fix the settings and remove the lines, or leave them in place.

Method 3: phpMyAdmin

  1. Open phpMyAdmin and your WordPress database.
  2. Open wp_options.
  3. Edit the siteurl and home rows.

After changing domain or moving to HTTPS

Posts, image links and some plugin settings still contain the old address. Use a search-and-replace tool designed for WordPress, which correctly updates serialised data, to replace the old URL with the new one. A plain SQL REPLACE can corrupt serialised settings.

Take a backup first. How to back up WordPress

Prefer to follow along?

Choosing somewhere to host WordPress? Traxio’s WordPress hosting includes one-click installs, LiteSpeed caching and free SSL.

If it doesn’t work

These guides cover the most common problems, starting with what you can see. Or browse every fix for a common problem.

Common questions

How do I change my WordPress site URL?

For a simple change, edit the WordPress Address and Site Address in Settings → General. If you are moving to a different domain, the URL also appears throughout your content and has to be replaced in the database with a search-and-replace tool.

Editing only the two settings on a domain move leaves images and internal links pointing at the old address. If the change locks you out of wp-admin, the values can be set in wp-config.php instead.

Spotted something out of date or unclear? Tell us and we’ll fix it.

Keep going