Last updated on

Site and Home URLs in WordPress are a core part of the system that the CMS uses to direct user traffic around your website.  The important parts that they are responsible for are reporting the domain name and appropriate protocol (HTTP or the secure HTTPS) to browsers that are accessing your website data.  Changing your website URLs is how you tell you website to use either a new domain name or change the transfer protocol used for all website content. This guide will demonstrate 4 ways that you can change your website URLs.

Change URLs from the WordPress Dashboard

Once you are logged into your website’s WordPress, navigate to Settings > General.

In the General Settings you will see two fields, WordPress Address and Site Address, which can be updated to match your new URL requirements.  Make sure to Save Changes once you have completed your updates.

Change URLs by editing wp-config.php

You can also set the URLs for your website by editing the code in the wp-config.php contained in your installation’s root directory.  Add the following example code directly to wp-config.php just above the line /* That’s all, stop editing! Happy blogging. */ and change example.com to your website’s domain name.  Make sure the change http to https if you are using an SSL on your website.

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

Change URLs directly in your database

To change the URL information in your website’s database you will need a database manager and one of the most common ones is phpMyAdmin.  In your database manager open the database associated with your website and select the _options table, this where the data for you website URLs are stored.

The first two rows in the _options table control the setting for your URLs and you can selecting the Edit option will allow you to change them.

Change URLs with WP-CLI

You can also update your website URLs via SSH using the commands provided by WP CLI. If your WordPress hosting includes ssh access, connect through SSH and run the following commands to change the URLs:

wp option update home 'http://example.com'
wp option update siteurl http://example.com">http://example.com'

 

SIGNUP FOR

BOLDGRID CENTRAL  

   200+ Design Templates + 1 Kick-ass SuperTheme
   6 WordPress Plugins + 2 Essential Services

Everything you need to build and manage WordPress websites in one Central place.

2 thoughts on “4 Ways to Change your Website URLs

  1. Hello, I received a note regarding mixed content errors and the need to update URLs on uploaded images on my site. Can you provide guidance on how I might do this? Thanks.

    • Hi Archie-
      The most common cause of this is that you still have images in your page content that are using the http:// instead of the https:// address. The easiest way to fix this is with the Really Simple SSL plugin, which will usually fix it just by installing and activating the plugin.
      Another way to resolve the issue that doesn’t require installing a plugin is to use WP-CLI’s Search and Replace function to search for “http://example.com” and replace it with “https://example.com” but you should definitely use caution with this approach, and make a database backup before making the change.

Leave a Reply

Your email address will not be published. Required fields are marked *