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. After connecting through SSH and accessing your installation you can use the following commands to change the URLs.
wp option update home 'http://example.com' wp option update siteurl http://example.com">http://example.com'
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.