How To Change Website Name in WordPress

Reading Time: 2 minutes

You may have noticed, when transferring a website, that the URL is still stuck on the old site even though you have changed the virtual host file to reflect the new domain name. Or you may see the URL entirely greyed out in your WordPress portal. This mismatch can happen if you can’t change the URL within WordPress to reflect the new site name. In this tutorial, we will show you how to change the URL through the database.

Step 1: Enter the Database

If you don’t have your database credentials you can certainly grab them from your wp-config.php file, usually located in /var/www/html. Copy your username and password, you’ll need these to enter phpMyAdmin.

/** MySQL database username */
define('DB_USER', 'yourusername');
/** MySQL database password */
define('DB_PASSWORD', 'userpassword');

If you Ubuntu 14.XX and higher, you can visit https://yourhostname.com/phpmyadmin and enter your database username and password copied from your wp-config.php. CentOS users can usually go to their WHM panel and type in “phpMyAdmin” into the search bar for a shortcut into their database.  With specialty platforms like Managed WordPress or Cloud Sites check with your support team to locate your phpMyAdmin instance.

Step 2: Find the WP_Options Table

Once you’ve entered phpMyAdmin, click on your database name on the left, in this case, ours is named 929368_kittens.In WordPress' database the wp-options table has the siteurl and home row needed to change the URL.

Locate wp_options, afterwards you’ll see rows on the right hand side.  The home and site_url row is needed as we will be changing these values to the new website name.

Note:
Search home or siteurl in the Filter rows: in the search box to these entries if not readily visible.

Select Edit in the row of siteurl and home to edit the URL, including “http” or “https” (if you already have an SSL on the domain name). Once you’ve changed your URL, select GO to save your changes.

In a WordPress database change the URL by editing the siteurl and home row.

Step 3: Update DNS

Your WordPress instance is now set to your new URL!  If you haven’t done so already, you may need to set your A record to your new IP address or clear your browser’s cache to visit your new URL.

Changing the domain name within WordPress is simple enough but sometimes code within an nginx.conf or .htaccess file can also direct a site back to the old domain name. It should also be noted that sometimes a plugin, theme or database can be referenced or hardcoded to read an old domain name.  For either problem, the Velvet Blue’s plugin or WP-CLI’s search and replace command cater to the issue.  Our Managed WordPress platform performs name changes automatically from our control panel, as well as core updates.  Check out how our Managed WordPress product can streamline your work.

Author Bio

About the Author: Echo Diaz

Throughout Echo's four year stint as a technical support specialist, her passion for breaking down complex concepts has to lead to a career in professional writing. As a top tier support specialist, she adds a distinctive element to her written work that speaks to customer feedback and concerns.

Echo occasionally pops her head out from behind her computer to watch her dog energetically run around the yard and unabashedly shovels money into buying tickets to see her favorite musical artists.

Refer a friend and receive hosting credit