Fixed Knowledge Base

Get all the help you need here.

Change a Wordpress URL

Posted 04th Oktober, 2018

Wordpress has two settings for website URLs - the Home URL and the Site URL. These are usually the same.

Wordpress links are direct rather than relative. That means that links and content is linked to using the full Wordpress URL (yourdomain.com/wp-content/images/1/1.jpg rather than /wp-content/images/1/1.jpg). This is excellent for SEO because it means you will not suffer any duplicate content issues. However, it means that you need to specify your main website URL.

On a new install of Wordpress these settings are pre-configured. However, if you want to change your URL/domain at a later stage you will need to update these settings.

Before changing your URL, you need to ensure that your web host accepts request for your new domain name. It should be registered and added to your web hosting control panel as a domain alias. Check it by visiting and seeing if it loads your current Wordpress site, albeit on the old domain. If you update the URL before pointing the new domain, your website will go offline.

Updating in the Admin area.

These can be changed as follows:

  1. Log into your Wordpress Admin Area
  2. Navigate to Settings on the left
  3. Navigate to General on the left
  4. Edit the Site URL and Home URL that show there.
  5. Press Update.

Alternative methods

If you cannot access the Wordpress admin area, the Home and Site URLs can be changed in two other ways:

Directly in the database

  • In the database. The site_url and home_url options are fields in the wp_options table. The following SQL will update it:
UPDATE wp_options SET `site_url` = 'url.com', `home_url` = 'url.com';

In the Configuration file

  • In the wp-config.php file. Here you can override Wordpress stored settings. Add the following:

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

The benefit of this is that the change is quick and easily reversible. However, this is a bodge rather than a true fix; the menu items in the Wordpress admin menu will now be greyed out.

Other References to the URL

Various plugins, theme and web designers hardcode the original website URL into the code. This means that even if you have changed the Wordpress URL successfully, you might still find content loading from the old URL, or erroring.

The following fixes can be run.

  • Run a find and replace on the database.
  • Download all files and search through them for references to your domain.

Useful Links and Resources