How to Change Your WordPress Site URLs (Step by Step)

Do you want to change your WordPress site URLs?

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

In this article, we’ll show you how to easily change your WordPress site URLs, step by step.

How to change your WordPress site URLs (step by step)

 

The most common reasons to change the URL on WordPress sites

Even though it is advisable to choose the URL as long-term as possible, there may be times when you want to change the WordPress URL:

  • You are moving the WordPress site from a local server or test environment to the live site.
  • In the future, the admin area should be accessible via a subdirectory. You reach the subdirectory by changing the WordPress site URL.
  • You perform a WordPress domain migration. In this case, it is important that you set up redirects in WordPress to redirect the old pages to the new one.
  • You have purchased an SSL certificate and convert your website to HTTPS. Again, you should set up a redirect from the old site using HTTP to the new one using HTTPS.

How to change the URL in WordPress

Below are three different ways to change the WordPress URL.

Change WordPress site URL in the admin dashboard.

The most common and easiest way to change the WordPress URL is to enter it directly in the admin dashboard. To do this, navigate to “Settings” > “General” in the admin area. There you will find the input fields where you can change the WordPress site URL or the website URL.

Usually, both URLs are identical. If you plan to put WordPress in a different directory, you only need to change the WordPress site URL – that is, the WordPress address. Note that when you click “Save”, the dashboard is accessible at the new URL. If a typo has crept into the new URL, you can use the wpconfig.php file to change the WordPress URL.

Start your website quickly and benefit from the most secure and up-to-date version of WordPress!

Domain
SSL
24/7 support

Using the wpconfig.php to change the WordPress URL

A second variant to change the WordPress URL works via the wpconfig.php file. This is located in the main directory of the WordPress installation. The easiest way to reach the file is with a FTP client like FileZilla. A text editor can be used to edit the file. To change the WordPress URL, add the following code at the very bottom of the file:

 

define('WP_SITEURL', 'https://www.new-domain.com');
define('WP_HOME', 'https://www.new-domain.com');

Once the changes are saved and the customized file is on the server, only the wpconfig.php file can be used to change the WordPress URL. The input fields in the dashboard are grayed out accordingly and not editable.

Change WordPress URL in the database

The third way to change the WordPress URL is through the database. To do this, log into the phpMyAdmin area. The record for the URL name can be found in the WordPress database in the first two rows under “wp_options”. Click on the domain name in the “option_value” column – an input field will open where you enter the new URL.

Why Change WordPress Site URLs?

There are many reasons why you might need or want to change your WordPress URLs. For example:

  • You may need to update site URLs when moving WordPress from a local server to live site.
  • If you have moved your WordPress site to a new domain name, then you will need to change site URLs to reflect the change.
  • If you’re moving WordPress to a different directory, such as removing /wordpress/ from your WordPress URL.
  • You’ll also need to change it when moving WordPress from HTTP to HTTPs.

Aside from that, you may need to change the WordPress address settings if you’re seeing the too many redirects error in WordPress or when troubleshooting another WordPress error.

What’s the Difference Between WordPress Address vs Site Address?

When changing your WordPress URL, you’ll need to update two separate settings, the ‘WordPress Address’ and ‘Site Address’.

This can be confusing for many beginners because they don’t know the difference between the two settings.

Your WordPress Address (URL) is the address where your WordPress files and folders are stored including your admin pages, media files, plugins, themes, and more.

Your Site Address (URL) in WordPress is the public facing part of your website. This is what your visitors will type into their web browsers to reach your website.

For majority of users, the WordPress Address and Site Address URL will be the exact same.

In some cases, large companies may host their WordPress sites on a different server because their corporate website has many other applications, and they want to isolate where each app is hosted to improve WordPress security.

But for most users, these two WordPress URLs need to stay the same.

With that said, let’s take a look at how to easily change WordPress site URLs. Simply use the quick links below to jump straight to the method you want to use.

  • Change WordPress site URLs from admin area
  • Change WordPress site URLs using functions.php file
  • Change WordPress site URLs using wp-config.php file
  • Change WordPress site URLs in the database using phpMyAdmin
  • Change WordPress site URLs using the AIOSEO plugin

Method 1. Change WordPress Site URLs from Admin Area

This method is the easiest and most beginner friendly. If you have access to your WordPress admin panel, then we recommend using this method.

Simply login to your WordPress dashboard and go to Settings » General.

Here, you can change your WordPress site URLs in the ‘WordPress Address’ and ‘Site Address’ boxes.

How to Change Your WordPress Site URLs (Step by Step)

For most websites, these will be the same URL.

After that, click the ‘Save Changes’ button to save your URL changes.

Now, you can visit your website to make sure that everything is working OK.

Method 2. Change WordPress Site URLs Using functions.php File

If you cannot access your WordPress admin panel for any reason, then you’ll need to use this method.

First, you need to connect to your WordPress site using an FTP client. For more details, see our guide on how to use FTP to upload files to WordPress.

Then, you need to locate your WordPress theme folder. For most users this will be something like /wp-content/themes/your-theme-folder/.

How to Change Your WordPress Site URLs (Step by Step)

In this folder, you need to open your functions.php file and edit it using your preferred text editor, like Notepad or TextEdit.

Then, you need to add the following code to the bottom of the file.

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

Don’t forget to replace ‘https://example.com’ with your own site URLs. You can now save your changes and upload the file back to your server using FTP.

Now, you can visit your website to see if everything is back to normal.

The advantage of this method is that it updates the site URLs in the database. WordPress updates the database for site URLs every time your functions.php file is loaded.

Once your website is working properly, you can remove the two lines of code from your WordPress functions.php file.

Method 3. Change WordPress Site URLs Using wp-config.php File

If you’re not sure which WordPress theme you need to edit, or can’t find your functions.php file, then you can use this method.

You’ll need to add your website URLs to your WordPress configuration file called wp-config.php. This file is located in the root folder of your website and contains important WordPress settings.

To change this file you’ll need to connect to your website using an FTP client. For more details, see our guide on how to use FTP to upload files to WordPress.

Then, you need to locate the wp-config.php file, which can normally be found in the root folder for your domain.

How to Change Your WordPress Site URLs (Step by Step)

After that, you need to add the following code just above the line that says ‘That’s all, stop editing! Happy publishing’.

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

Don’t forget to replace ‘https://example.com’ with your own domain name.

You can now save your changes and upload them back to your server. After that, visit your website to make sure that everything is working fine.

Method 4. Change WordPress Site URLs in the Database Using phpMyAdmin

Another way to update WordPress site URLs is by changing them directly in your WordPress database.

You can do this directly from your WordPress hosting account dashboard.

Before you do this, we recommend making a WordPress database backup. This is really important and will help you undo any WordPress database changes if anything does wrong.

For more details, see our guide on how to make a WordPress database backup.

After that, you need to login to your web hosting account dashboard and click on the ‘phpMyAdmin’ icon in the ‘Databases’ section.

Note: The steps might be slightly different depending on your hosting provider. However, all cPanel hosting providers like Bhosting give you the ability to edit database settings.

How to Change Your WordPress Site URLs (Step by Step)

This will automatically launch the phpMyAdmin application, which gives you a web-based interface to edit MySQL databases. To learn more, see our beginner’s guide to WordPress database management with phpMyAdmin.

First, you need to click on your WordPress database in the left-hand column. This will display tables inside your WordPress database.

Then, click on the ‘wp_options’ column option.

How to Change Your WordPress Site URLs (Step by Step)

By default the database prefix is ‘wp_’ but since you can change your WordPress database prefix it might be something different.

Now, you’ll see rows inside the options table. You need to locate the ‘option_name’ column where ‘siteurl’ and ‘home’ will be listed.

How to Change Your WordPress Site URLs (Step by Step)

First, click on the pencil ‘Edit’ icon to the left of each row and change the ‘option_value’ field to your new site URL.

You may need to scroll down the options table to find the ‘home’ option name.

After that, click the ‘Go’ button in the bottom right corner to save your database changes.

How to Change Your WordPress Site URLs (Step by Step)

Now, you can visit your website to make sure everything is working as it should.

Method 5. Change WordPress Site URLS Using AIOSEO Plugin

All of the methods above will help you change the URL of an existing WordPress installation. This method works a little different, since you’ll be changing your current WordPress URL to point to a new URL/WordPress installation.

This is common when you’re moving your WordPress website to a new domain name and don’t want to lose rankings or experience downtime.

The best way to do this is with the AIOSEO plugin. It’s the best WordPress SEO plugin in the market used by over 3 million websites.

How to Change Your WordPress Site URLs (Step by Step)

It has a built in redirection manager lets you create entire website redirects in a couple of clicks.

How to Change Your WordPress Site URLs (Step by Step)

Redirecting your website this way preserves the links from sites that were linking to your old domain, prevents 404 errors, and creates a better experience for your visitors.

To do this the right way you’ll need to create a duplicate of your existing site, move it to a new domain, and then redirect your old site to your new site.

For more details, see our guide on how to update URLs when moving your WordPress website.

If you want to redirect single posts and pages in WordPress, then see our beginner’s guide to creating 301 redirects in WordPress.

Changing WordPress URLs Frequently Asked Questions (FAQs)

Over the years we have helped hundreds of thousands of users create a WordPress website, start a blog, or start an online store.

In this time, we’ve answered many different questions related to changing WordPress URLs. Below are some of the most frequently asked questions we receive.

Why are my WordPress Address and Site Address fields greyed out?

If the WordPress address (URL) is greyed out on the settings page of your admin area, then it means the URLs are hard coded in the wp-config.php file.

How to Change Your WordPress Site URLs (Step by Step)

To change your WordPress URL, you’ll need to follow the fourth method above to edit the wp-config.php file and change the URL accordingly.

How to recover WordPress after URL address change in settings?

Sometimes non-techy users can accidentally change the WordPress URL and Site Address settings from the WordPress admin area.

To recover from that, you’ll have to follow our guide above to change the WordPress URLs back using the functions.php, wp-config.php, or the database method.

Is there a WordPress change URL plugin that can bulk update URLs in all blog posts, pages, and other content areas?

Yes, you can use the Go Live Update URLs plugin.

When you change your WordPress URL, you’ll need a way to bulk update links through your WordPress posts, pages, and other areas in your database. The plugin above is a huge time saver.

Aside from using it to update URLs when moving websites, we also use it for various other platform migrations like moving from WordPress.com to WordPress.org, Wix to WordPress,and more.

We hope this article helped you easily change the WordPress site URLs. You may also want to see our guide on how to get  SSL certificate for your WordPress site and our expert picks of the best live chat software for small business.

 

Leave a Reply

Your email address will not be published. Required fields are marked *