🌞 Summer Sale DISCOUNT!

How to Change Your WordPress Site URL

How to Change Your WordPress Site URL

86 / 100

Changing your WordPress site URL can be a crucial step in maintaining the functionality and accessibility of your website.

Whether you’re rebranding, migrating to a new domain, or simply optimizing your site’s structure, it’s important to understand the process and potential implications.

In this post, we’ll walk you through the steps to effectively change your WordPress site URL and avoid any potential pitfalls.

So, let’s dive in and explore the best practices for updating your website’s URL.

1 Why Change WordPress Site URL?

Changing the site URL in WordPress carries significant importance for several reasons:

Reflecting Rebranding or Redirection: If your website is undergoing a rebranding process or if you’ve decided to redirect it to a new domain, changing the site URL becomes essential. It ensures that your online identity aligns with your new brand, maintaining consistency in your digital presence.

Avoiding Broken Links: All internal links should reflect the new URL structure when your site’s URL changes. Failing to do so can result in broken links, causing frustration for your visitors and potentially harming your website’s credibility.

Enhancing User Experience: A smooth transition to a new site URL ensures a seamless user experience. Your visitors won’t encounter errors or missing content, which can help maintain their trust in your website.

Security and Compatibility: Transitioning to a new URL might involve switching to HTTPS for a secure connection. This is crucial for user security and SEO, as search engines favor secure websites.

2 What is WordPress Address URL and Site Address URL?

WordPress Address (URL) and Site Address (URL) are two essential settings in WordPress that define the web addresses (URLs) where your WordPress site can be accessed. They serve different purposes, and understanding their distinctions is important for managing your WordPress website effectively.

The WordPress Address (URL) points to the directory where your WordPress core files reside, typically behind the scenes.

The Site Address (URL) represents visitors’ public address to access your website. It appears in your visitor’s browsers’ address bars when they visit your site.

It’s necessary to ensure that these URLs are correctly configured, as discrepancies between them can lead to issues like broken links, incorrect resource loading, and SEO problems.

Additionally, when moving your WordPress site to a different domain or directory, updating these settings is necessary to maintain proper functionality and appearance.

3 Changing the WordPress Site URL

Let us now discuss different methods to change your site URL.

Note: Before making any changes, creating a full WordPress site backup is important. This backup will help you revert back in case anything goes wrong. Refer to our dedicated tutorial on backing up WordPress websites.

3.1 Change WordPress Site URL From Admin Area

This method is the simplest method to change your site URL.

First, log in to your WordPress dashboard and navigate to Settings → General, as shown below.

General Settings

On the General Settings page, you’ll find two fields labeled WordPress Address (URL) and Site Address (URL).

To change your site’s URL, update the WordPress Address (URL) field with the new URL you want to use. Ensure that the URL format is correct, typically beginning with http:// or https://.

Next, update the Site Address (URL) field with the same new URL you entered in the previous step. It’s essential that both the WordPress Address and Site Address match to avoid any issues.

Update Site Address and WordPress Site URL

3.2 Change WordPress Site URL Using functions.php File

If you cannot access your WordPress admin, you can change the WordPress site URL using the functions.php file. However, this method should be cautiously approached, as incorrect modifications can result in a broken site.

To begin with, access your WordPress files using an FTP client like FileZilla or your hosting provider’s file manager.

Navigate to your WordPress theme folder, usually located in the wp-content/themes/ directory. Inside the theme folder, find the functions.php file.

Locate functions.php file

Use your preferred editor to open the functions.php file and add the following code to the bottom of the file:

update_option( 'siteurl', 'https://yoursite.com' );
update_option( 'home', 'https://yoursite.com' );

Replace https://yoursite.com with your new site URL. Once you’ve added the code, save the functions.php file and upload it back to the server.

Visit your website to verify if everything is working correctly.

3.3 Change WordPress Site URL Using wp-config.php File

You can use this method if you are unsure which WordPress theme you need to edit or can’t find your functions.php file.

You can access your WordPress files using an FTP client like FileZilla or your hosting provider’s file manager. Navigate to the root directory of your WordPress installation, where you can find the wp-config.php file.

Edit wp-config.php file

Next, right-click on the wp-config.php file and select the View/Edit option to edit the file. Add the following code just above the line that says, ‘That’s all, stop editing! Happy publishing’.

define( 'WP_HOME', 'https://yoursite.com' );
define( 'WP_SITEURL', 'https://yoursite.com' );

Don’t forget to replace https://yoursite.com it with your desired new site URL. After adding the code, save the file and upload it to the server.

3.4 Change WordPress Site URL in the Database

This method should be cautiously approached as it directly modifies the WordPress database.

Log in to your web hosting control panel and navigate to the phpMyAdmin section to access the database management interface.

phpMyAdmin interface

Note: The steps might slightly differ depending on your hosting provider. However, all cPanel hosting providers allow you to edit database settings.

You’ll find a table in your WordPress database named ‘wp_options’(the prefix wp_ may vary based on your WordPress installation). Click on the table to open it.

wp-options table

In the wp_options table, you’ll see rows with option names. Look for two specific rows: siteurl and home. These rows store your site’s URL information.

Click on the Edit button next to the siteurl row. In the option_value field, replace the current URL with your new site URL.

replace the URL

Click the Go button in the bottom right corner to save your database changes. 

click the Go button

Repeat the same process for the home row.

Repeat the procedure for the home row

Visit your website using the new URL to ensure everything is working correctly.

3.5 Change WordPress URL With WP-CLI

Changing the WordPress URL using WP-CLI(WordPress Command Line Interface) is another method, especially for those comfortable with the command line.

To use WP-CLI, you need access to your server, open your terminal or SSH client, and log in to your server.

Add the following commands to change the site URL:

wp option update home 'https://yoursiteurl.com'
wp option update siteurl 'https://yoursiteurl.com'

Replace the https://yoursiteurl.com text with your actual domain name.

4 Frequently Asked Questions

What should I do with external links pointing to my old URL?

Update external links manually or use redirection plugins to ensure they point to your new URL. This maintains user experience and SEO.

How can I restore my WordPress site if I accidentally modify the URL settings?

Occasionally, even users without technical expertise may unintentionally alter the WordPress URL and site address settings within the WordPress admin area. To recover, you’ll need to follow our instructions to revert the WordPress URLs. This can be done by editing the functions.php file, wp-config.php, or adjusting the settings directly within the WordPress database.

Can I use a plugin to change the site URL?

Yes, plugins like Go Live Update URLs can assist with URL changes.

5 Conclusion

In the fast-paced digital world, having the flexibility to adapt your site’s address to match your evolving needs is a valuable asset.

Whether you’re rebranding, shifting to a new domain, or enhancing your online presence, WordPress provides the tools to make this transition smooth and painless.

With the various methods discussed in this post, we hope you can handle URL changes while keeping your site fully functional and search engine-friendly.

 If you like this post, let us know by Tweeting @rankmathseo.

Email Icon

Don’t Miss Any Future Post!

Sign up today for Exclusive SEO Articles