4 Ways You Can Change Site URLs in WordPress

WordPress is used by over a billion websites as a Content Management System. It is open-source and comes with default settings for users to modify. When it comes to URLs too, you can make changes. A website consists of web pages, and URLs are the unique address to a web page in a website. You might feel the need to change them for variety of reasons. Perhaps for SEO reasons, or you’re moving from HTTP to HTTPs. Whatever might be the case, you can change your site URLs in four different ways.

Change URLs from Admin Area

This is the most easiest way to change site address URLs in your WordPress website is to change it from the Admin dashboard. Also you not need to edit any codes in here. Here are the steps involved in this procedure:
  • Log into your WordPress admin dashboard
  • Select “Settings” from the left sidebar menu
  • In the General Settings tab, you’ll see two URL-specific options, “WordPress address (URL)” and “Site Address (URL)”. Site address is the URL address people type in to visit your website, whereas WordPress address URL is the place where your core WP files live. Edit both the fields and provide the new URL
wordpress1.png

  • Enter the new URL you want to display
  • Save the Changes and exit
Edit wp-config.php File

If, for some reasons, you aren’t able to change url from the admin section, you can do so by editing the wp-config file. For this, you need to access the your website’s installation directory either by FTP client or file manager.

Once opened, add the following code towards the end of the file:

Code:
define(‘WP_HOME’, ‘https://address.com’);
define(‘WP_SITEURL’, ‘https://address.com’);
Save the wp-config file and exit. This also overrides the existing URLs in the General Settings menu. To confirm that the changes have been made, visit your WP website using the new address.

Edit the wp-config file only if you’re unsure which WP theme you need to edit. Otherwise, a better way is to edit your functions.php file instead.

Edit functions.php File

The functions.php file is unique to every WP theme and contains various features of your website which you can modify. It is also known as the theme function file. If you know which theme to work on, then edit the functions.php file instead of wp-config file. Most of the process remains the same.

Connect to your WP server using an FTP client. Then navigate into your theme’s folder and locate functions.php file.

Open the file and add the below codes:

Code:
update_option(‘siteurl’, ‘https://address.com’);
update_option(‘home’, ‘https://address.com’);
Change using WP-CLI

If you’ve been using the Command Line Interface provided by WordPress, then you can employ this process. To get started, you need to connect with your WP server using the SSH. Follow the steps to do this:
  • Open the terminal and connect to your server. If you’re on Windows, then you’d need app like Putty or Bitvise
  • The enter the following commands:
Code:
wp option update home ‘https://websiteURL.com’
wp option update siteurl ‘https://websiteURL.com’
With just these two line of code, you have successfully changed your WordPress site URLs.
Author
bhawanisingh
Views
157
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from bhawanisingh

Top