How to Properly Change WordPress URL (4 Methods)

Chưa được phân loại

Need to change your WordPress URL?

You might be changing to a new domain name, updating your site to use HTTPS, or any number of other scenarios.

In this post, we’ll discuss some of the most common reasons that you might want to change your site’s URL. Then, we’ll show you four easy-to-follow ways to change your WordPress URL.

Table of contents:

Why you may want to change your WordPress URL

Deciding to change your WordPress URL shouldn’t be taken lightly. After all, the domain name helps with brand recognition. People get used to a particular domain when seeking out your content.

However, you may find that there are reasons to completely shift to a new domain or maybe add some extra SEO or security power to the URL.

Here are some of the instances you may want to change the WordPress URL:

Scenario 1: Completely shifting to a new domain name

It’s not uncommon for website owners to have a little buyer’s remorse after configuring domains. Sometimes you have a shift in the brand name or you realize that another domain is available that sounds catchier than the one you currently own.

Regardless of the reason, this means that you’re trying to completely change the URL and move all website files to a new domain.

This process involves moving your entire WordPress installation to a new domain.

An example of this migration would be from to, where the primary domain is changed.

Scenario 2: Adding security with the help of an HTTPS domain

Using HTTPS helps make your site more secure and can even give you a rankings boost in Google.

To move your site from HTTP to HTTPS, you’ll first need to install an SSL certificate. Most hosts offer free SSL certificates and make it easy to use them.

Then, you’ll need to change your site’s URL to use the new HTTPS version.

Scenario 3: Moving content from a subdirectory

Here’s a situation where you may have placed all, or a portion of your website, on a subdirectory. However, some subdirectories begin getting more attention than what’s on the primary domain’s page.

Therefore, the website owner might decide to shift all content from the subdirectory to the homepage URL.

An example of this would be:

  • Shifting from to
  • Moving from to
  • You may also consider moving from the primary domain to a subdirectory.

The primary, or parent, domain is situated as the “face” of your website. This tends to be one of the most common reasons to change the WordPress URL, considering some subdirectories become super popular and should become the main page.

How to change WordPress URL in all scenarios

⚠️ Important: This is a big change, so we’d highly encourage you to back up your site before implementing any of these methods. That way, you’ll always have a working copy in case something goes wrong.

How to back up WordPress with a free plugin 👈

After examining the reason you may want to change your WordPress URL, now it’s time to walk through the process of doing so. Luckily, there are a handful of methods to get the job done.

Method 1: Change WordPress URL in your WordPress dashboard

It’s best to focus on this method first before getting into anything more technical. You may find that adjusting your WordPress URL in the admin dashboard may be all you need to shift from a subdirectory or change the address altogether.

However, some sites may have the URL hardcoded in the wp-config.php file. In those cases, you’ll have to use Method 2 below.

Having said that, here’s how to change the WordPress URL in the admin dashboard:

In your WordPress dashboard, click on Settings → General.

settings and general

Locate the following fields:

  • WordPress Address (URL)
  • Site Address (URL)
wordpress address - change WordPress URL

The WordPress Address is where users go to find the primary blog or website.

The Site Address indicates the location of your site files.

In the vast majority of situations, both of these fields should be the same.

However, you can change these fields if you already own the domain and need to shift from a temporary domain or from something you previously chose.

Make sure you clear your site cache after changing these URLs. Your site will only be accessible from the new URLs in these fields.

Method 2: Use the wp-config.php file

A WordPress site may have a hardcoded URL in the wp-config.php file. If this is the case, the WordPress Admin and Site Address fields are grayed 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 option is to modify the WordPress URL in your wp-config.php file.

Begin by accessing the wp-config.php file. You can do this with:

Our primary suggestion is to connect to your site files using FTP (file transfer protocol). Our FTP guide is here to walk you through the process.

Once you’ve connected to your server, open the wp-config.php file, which is most often located at the root of your WordPress site.

Paste the following code at the top of the file. Make sure you insert your actual domains, instead of the examples below.


If these are already in the wp-config.php file, you’ll need to change them to reflect what you want. Otherwise, the new code in this file hardcodes the domains. You can always go in and remove the code.

Method 3: Use the database to change WordPress URL

Here, you’ll change the WordPress URL directly in your site database. This is done with phpMyAdmin. The phpMyAdmin tool is found in your host’s dashboard or cPanel.

⚠️Warning: Making changes to your site’s database could cause your site to break if not done properly. If you don’t feel comfortable, we’d recommend hiring a developer or using one of the other methods.

Go to phpMyAdmin and select your site’s database from the list on the left side. Go down on the page until you see the wp_options table. Some sites may have different names for this, but most of the time it ends in “_options“.

wp-options - change WordPress URL

This file lets you enter a new siteurl and home.

All you have to do is select those values and type in the new domains. Click Go to save them.

database changes - change WordPress URL

Remember, this modification means that your site is now only accessible through the new URL.

Method 4: Change WordPress URL using WP-CLI

Only complete this method if you’re a developer with experience. The process involves using command lines to run specific tasks.

If you’re a developer–or you hired one–use the following command to update your URL site values:

wp option update home ''
wp option update siteurl ''

Replace the “myexamplesite” text with your actual domain to get this done!

An important final step: handling old links and URLs

You’ve changed your WordPress URL for the future, but what about the old page URLs and links in your articles? Chances are you’ll stumble upon broken links after this process, so it’s important to resolve this issue.

This applies no matter which method you use from above.

To fix your existing links after changing your WordPress site URL, you can use the free Velvet Blues Update URLs plugin.

⚠️ Important: Make sure to back up your website before you use the plugin. Because you’ll be changing content in your site’s database, you might accidentally break something. So, if you haven’t already, get that recent backup ready before you continue.

How to back up WordPress with a free plugin 👈

Once you install and activate the plugin, go to Tools → Update URLs.

update urls

Fill in the one field with your old URL, then type in the new (desired) URL in the other field. Check off which URL instances you would like to change. This would most likely include URLs in page content and most of the other checkboxes.

Click on the Update URLs Now button to finish the process.

old and new url

You can then uninstall the Velvet Blues plugin.

Do you have any questions about changing your WordPress URL?

Most simple modifications only require you to go into the WordPress dashboard or wp-config.php file. Other than that, we suggest reaching out to a developer when tweaking your database or using command lines.

Finally, you can also change the URL for other parts of your WordPress site. For example, we have a guide on how to change the WordPress login URL that you might find useful.

Still have any questions about how to change your WordPress URL? Let us know in the comments below.

Free guide

5 Essential Tips to Speed Up
Your WordPress Site

Reduce your loading time by even 50-80%
just by following simple tips.

Bài viết liên quan

Trả lời

Email của bạn sẽ không được hiển thị công khai.