URL, or Universal Resource Locator, is the address that we use to reach a website. If you have one or more WordPress website(s), you should know that each of them has two URLs. The first one is the Site Address (wp_site), which refers to the address that people use to enter your site. The second one is the WordPress address (wp_home), where the files that keep your site running are stored. You can find them by going to the general settings in the WordPress dashboard.

Reasons to change WordPress URL

There are good reasons why you may need to change WordPress URL. The statements below apply if you want to market your site better and get more traffic.

  • Moving your website to a new domain
    If you find a domain that has a better chance of getting more traffic, or you decide to rebrand your business.
  • Changing from HTTP to HTTPS
    Nowadays, people are keen on security. That is why you may want to get an SSL certificate for your site. It is even more critical if you run an eCommerce site.
  • Moving your website from subdomain to root domain
    Search engines usually regard subdomains as separate sites from their root domain. If you want to get search engines to look at the root domain, you will want to leave the subdomain.
  • Adding or removing WWW
    Many people have been debating about whether you should use the triple W in your domain name. But whichever you choose, it is mandatory to maintain access to your website by updating the URLs.

Regardless of the motives, you won’t be able to access the back-end of your website after changing its URL. Why? Because WordPress always retains your original address unless you modify it in the settings.

How to change WordPress URL

If you don’t edit the site and WordPress URL correctly, neither you or your visitors will be able to access your website. This article will guide you through six ways to change the two URLs.

From the Admin Dashboard

The first option is to do it through WordPress. All you need to do is visit the WordPress admin dashboard. Find settings on the menu to the left side of the screen and click general. After that, you can edit your site and WordPress address. After that is done, click save. Remember that doing this will log you out of the dashboard.

WP Dashboard

WP General Settings

By Editing wp-config.php

Changing your URLs from the WordPress dashboard is easy. Nevertheless, you cannot always change them with the particular method. In some occasions, you will find that the address space is greyed out. That means you need to edit the wp-config file. You can access the file in your WordPress directory via file transfer protocol (FTP) or secure shell (SSH) connection. To do that, you need to have an FTP client and connect it to the directory. First, you should make a copy of the file in case it doesn’t work after editing. Once you open wp-config.php, insert these two lines at the top of the script:



// Configuration common to all environmnets
include_once__DIR__ . '/wp-config.common.php';

// ** MySQL settings ** //
/** The name of the database for WordPress */

Save the file and upload it once the task is done.

By Editing functions.php

This method is similar to editing the wp-config file. Navigate through your WordPress directory and find functions.php. Inside, put the following lines below <?php:


Like in the previous method, save the file when you’re done and put it back to the directory.

Using WP-CLI

For those who do not know, CLI stands for command line interface. WP-CLI is a tool for WordPress users who like to dig deeper into code, editing and controlling many things in your WordPress site with less hassle. However, WP-CLI is only available for operating systems that support UNIX environments, such as Mac OS and Linux. Before using it, you need to download and extract its files into your site’s directory.

To change wp_site and wp_home through WP-CLI, simply open it and input these lines:

wp option update home ‘http://domainname.com’
wp option update siteurl ‘http://domainname.com’

In another case, you need to set the constants in wp-config.php to make the above code work. Your code should look like this:

wp config set WP_HOME http://domainname.com --type=constant
wp config set WP_SITEURL http://domainname.com --type=constant


If you cannot change your wp_home and wp_site URL via admin dashboard, you can also use this technique. It is the same as editing the wp.config.php file, but you use the RELOCATE flag. The steps are easy. First, open wp-config.php and add define(‘RELOCATE’, true); at the top of the file. After saving the file, try to visit http://domainname.com/wp/wp-login.php and log into your dashboard. Check the URL spaces in the general settings. If they contain your current address, open wp-config.php again and delete the RELOCATE flag.

Using phpMyAdmin

If none of the options above work, you can try to change the URLs through the site’s database. You can do this using any database management program, but you should prefer to use phpMyAdmin.

Before starting this method, you should backup your site’s database through the control panel in your hosting service. Now let’s begin. Open phpMyAdmin and choose the database you want to edit from the menu on the left. Next, click on the wp_options table. Search for home and siteurl and click on the pencil icon to edit them. Lastly, insert your new URL in the option_value space and click go to save.

phpMyAdmin WP URL


It is essential to keep your WordPress URLs updated as you change your website’s address. This helps avoid any mistakes that can render the site inaccessible. You can try any of the solutions in this article to fix it. Have other problems, please leave a comment below, and we will be glad to help!

  • php
  • my sql
  • intel
  • cloudlinux
  • nginx
  • cloudflare
  • wordpress