How to Change WordPress Site URL (6 Easy Methods)

Need to change your WordPress site URL?

Whether you’re switching from HTTP to HTTPs, changing your domain name, migrating from a local server to a live site, or transferring to a subdomain, you’ll need to learn how to change your WordPress URL.

In this article, we will show you how to change your WordPress site URL using different methods.

Why Might You Want to Change Your WordPress URL?

There are various reasons why you may need or want to change your WordPress URLs.

  • You may need to change the site URL when migrating WordPress from a local server to a live site.
  • If you’ve migrated your WordPress site to a new domain name, you’ll need to update the site URLs.
  • If you’re relocating WordPress to a new directory, such as deleting /WordPress/ from your WordPress URL.
  • When switching WordPress from HTTP to HTTPs, you’ll also need to change it.

Aside from that, if you’re getting too many redirection errors in WordPress or debugging another WordPress error, you may need to change the WordPress address settings.

What Is the Difference Between a WordPress Address and a Site Address?

When you change your WordPress URL, you must update two different settings: the WordPress Address and the Site Address.

Many beginners may be confused by this since they are unfamiliar with the difference between the two settings.

Your WordPress Address (URL) is the location of your WordPress files and directories, including admin pages, media files, plugins, themes, and more.

Your Site Address (URL) is the public-facing part of your website. This is what your users will type into their web browsers to go to your website.

The WordPress Address URL and Site Address URL will be the same for most users.

With that said, let’s look at how to change WordPress site URLs using different methods.

How to Change WordPress URL

After looking at why you might want to change your WordPress URL, it’s time to walk through the method. Fortunately, there are several methods for completing the task.

Note: Since this is a major change, we strongly advise you to backup your site before using any of these methods. That way, you’ll always have a functional copy if something goes wrong.

Here are some best backup plugins for WordPress you should look to backup your site.

Methods 1: Change WordPress URL via the Admin Dashboard

This method is the easiest and most suitable for beginners. We recommend using this method if you can access your WordPress admin panel.

Simply log in to your WordPress dashboard and go to Settings » General.

Change the URLs of your WordPress sites in the WordPress Address and Site Address boxes.

WordPress URL Settings

Most websites will have the same URL.

Then, click the Save Changes button to save your settings.

You may now browse your website to ensure that everything is working properly.

Method 2: Change WordPress Site URL Using wp-config.php File

A WordPress site may contain a hardcoded URL in the wp-config.php file. If this is the case, the WordPress Address and Site Address fields are greyed out and not editable from Method 1. In short, the hardcoded URL in the wp-config.php file overrides whatever is in the Settings module.

So, the next step is to change the WordPress URL in your wp-config.php file.

To change this file, you must use an FTP client to connect to your website.

Then, look for the wp-config.php file, which is usually located in the root folder of your domain.

After that, add the following code just above the line that says, That’s it, stop editing! Happy publishing!

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

Remember to replace https://example.com with your own domain name.

You may now save your changes and upload them to your server. After that, check your website to ensure that everything is working properly.

Method 3: Change WordPress Site URL Using functions.php File

If you’re not unable to access your WordPress admin panel for any reason, you will need to use this method.

First, use an FTP client to connect to your WordPress site.

Then, go to your WordPress theme folder. You can find the theme folder under /wp-content/themes/your-theme-folder/.

In this folder, open your functions.php file and paste the following code at the bottom.

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

Remember to replace https://example.com with your own site URLs. You may now save your changes and use FTP to upload the file back to your server.

You may now check your website to see whether everything is back to normal.

The benefit of this method is that it updates the site URLs in the database. Whenever your functions.php file is loaded, WordPress updates the database for site URLs.

Once your website works, remove the code from your WordPress functions.php file.

Method 4: Use the Database to Change the WordPress URL

Another method for updating WordPress site URLs is to change them directly in your WordPress database.

You may perform this from the dashboard of your WordPress hosting account.

Note: Changing your site’s database might break it if not done correctly. If you’re unsure, we’d suggest hiring a developer or using one of the other methods. Alternatively, create a WordPress database backup, which will allow you to undo any WordPress database changes if something goes wrong.

After that, go to your web hosting account dashboard and click on the phpMyAdmin link in the Databases section.

phpMyAdmin

This will open the phpMyAdmin application, which allows you to edit MySQL databases using a web-based interface.

Now, from the left-hand column, select your WordPress database. This will show tables inside your WordPress database.

Then, select the wp_options table from the list.

Select wp_options Table form Database

The database prefix is set to wp_ by default. However, if you changed your WordPress database prefix, it may be something different.

You should now see rows within the options table. Find the option_name column, where siteurl and home are listed.

Edit Option Name

Next, click the Edit link to the left of each row and edit the option_value field to your new site URL.

Change Option Name URL

Once updated, click the Go button to save your database changes.

You may now browse your website to ensure that everything is working effectively.

Method 5: Change WordPress URL Using WP-CLI

Only use this method if you are an experienced developer. The procedure entails using command lines to carry out certain tasks.

If you are a developer or have hired one, execute the following command to edit your URL site values:

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

Replace the https://example.com text with your actual domain to get this done!

Methods 6: Change WordPress Site URL Using AIOSEO Plugin

All the methods described above will help you in changing the URL of an existing WordPress installation. This method is slightly different because you’ll redirect your current WordPress URL to a new URL/WordPress installation.

This is typical when migrating your WordPress website to a new domain name, and you don’t want to lose rankings or face downtime.

Using the AIOSEO plugin is the most effective method to achieve this. It is the most popular WordPress SEO plugin on the market, with over 3 million websites using it.

All in One SEO Pack - Best WordPress SEO Plugin

It has a redirection manager that allows you to build full website redirects with only a few clicks.

AIOSEO Change Website URL

Redirecting your website in this way keeps links from sites that were linked to your old domain, prevents 404 errors, and improves the visitor experience.

To do this correctly, you’ll need to duplicate your current website, move it to a new domain, and then redirect your old website to your new website.

Summary

If you want to change your WordPress URL because you’ve changed domains or are migrating to HTTPS, you have several methods.

You may change the settings via the WordPress admin, hardcode them in your wp-config.php file, edit the database, or use WP-CLI. Work your way through the methods listed above until you find one that works for your site, and you’ll have your new WordPress URL up and running in no time.

We hope this article helps you easily change the WordPress site URLs.

You may also want to see our following articles:

Lastly, follow us on Twitter and Facebook for regular updates on new articles.