Change the WordPress URL: How to do it without messing up

Imagine this—you’re sailing smoothly on the WordPress sea when suddenly, it’s time to steer your digital ship to a new port. That’s right, changing your WordPress URL is the voyage you didn’t know you needed, until now.

You’ve got your destination in mind, but between you and solid ground lies a sea of URLs, redirects, and the ever-looming dread of broken links that can sink your site’s SEO quicker than you can say “404 error”. Fear not, this is your beacon in the fog.

We’ll navigate through the murky waters of site migration, anchor down your domain name update truths, and ensure no SEO sail is left untrimmed. By the journey’s end, you’ll be captain of your website’s destiny, confidently at the helm, changing your WordPress URL with the finesse of an online Columbus.

Expect no jargon whirlpools here. We’ll break down the change site domain checklist, tick off those key WordPress settings, and cruise through without capsizing your search rankings. So, all aboard? Let the adventure begin.

So how to change a WordPress URL? It only takes a few simple steps:

  • Login to WordPress
  • Open the existing page or create a new page
  • Enter a Title if necessary
  • Save the page, this will automatically create a URL
  • Look directly under the title field, you will see Permalink: followed by the URL
  • Click the Edit button behind the link
  • Type in the new URL and click OK
  • Save the page or post

What? You didn’t get here to find out how to change a page’s URL? Good, we’re going to cover that in the rest of the article. 

How to change your WordPress URL: the methods

There are several ways of changing the WordPress URL. So let’s see how to change a WordPress domain.

Note: When you decide to change the domain name, be careful to edit the values correctly to avoid bringing the whole site down.

Change WordPress URL in Admin Dashboard

This is the most common method to change the WordPress domain in the admin dashboard. On the left-hand side, under “Settings,” click into “General.” You can then update the following:

  • WordPress Address (URL): The site address to reach your blog.
  • Site Address (URL): The address of your WordPress core files.

If you are not giving WordPress its own directory, both of these should match. Keep in mind that once you save the changes, you will be able to access the dashboard via the new URL only.

To avoid receiving a redirect error, clear your WordPress cache when you change the WordPress URL in the database.

Note: If the fields above are grayed out, it is most likely because you already have hard-coded values in your wp-config.php file. If that is the case, proceed to the following method:

Change the WordPress URL in wp-config.php File

If you want to edit the WordPress home URL, you can also do it via your wp-config.php file. Keep in mind that values in wp-config.php override the settings in method one. If the fields are not editable, they are probably hard-coded in this file.

The wp-config.php file is typically located at the root of your WordPress site and can be accessed via FTP, SSH, or WP-CLI. To hard-code WP_HOME and WP_SITEURL, simply input the following code towards the top of the file, changing the values to reflect your domain.

define(‘WP_HOME’,’https://yourdomain.com’);

define(‘WP_SITEURL’,’https://yourdomain.com’);

How to change the URL directly in the database

You can change the WordPress domain name directly in the database using phpMyAdmin which you can access through your dashboard in cPanel or Plesk. However, this method should not be your first choice and it should only be done if the first two methods don’t work for you.

Keep in mind that manipulating and changing tables directly from phpMyAdmin could break your site if not done correctly. If you have no experience changing the WordPress domain from the database, you should probably consult a developer first. And speaking of tables, check out wpDataTables for options on managing your front-end WordPress tables.

If you are determined to edit the WordPress address URL this way, click on your database on the left-hand side in phpMyAdmin. Click on the wp_options table and then you will be able to change both the values for the “siteurl” and “home” rows.

Enter your domain name (URL) and click “Go.” Keep in mind that from this point on, your WordPress dashboard will only be accessible via the new URL.

Change WordPress URL with WP-CLI

The least recommended way to change site URL WordPress is directly with WP-CLI. This is not to be done unless you are a developer. If you are not familiar with WP-CLI, you can find out more in our in-depth post on managing WordPress from the terminal.

Here is an example of the command to update your WordPress URL values:

wp option update home ‘http://example.com’

wp option update siteurl ‘http://example.com’

Moving Sites

Sometimes when you move your WordPress site from one location to another, you have to manually edit the data in the database to ensure that the new site URL gets recognized properly.

However, keep in mind that there are many tools out there that can help you with this and it is safer to use one of them than to modify the WP site URL manually.

Altering Table Prefixes

A great number of WP administrators run several WordPress installations off of one database using various wp-config.php hacks. These hacks often involve dynamically setting table prefixes. That being said, if you alter your table prefix, you must update several entries within the prefix_usermeta table as well.

Don’t forget to back up your database first because the SQL changes are permanent. Remember to alter the table prefix in the usermeta tables if you are changing table prefixes for a site. This will allow the new site to properly recognize user permissions from the old site.

Changing the wp-config.php file

If your database has moved or changed in certain ways, you will need to update the WP configuration file.

You don’t have to do this unless:

  • your database has moved to another server and is not running on your localhost
  • you have renamed your database
  • you have changed the database username

So here is what you have to do:

  • Make a backup copy of your wp-config.php file.
  • Open the wp-config.php file in a text editor.
  • Review its contents. In particular, you are looking for the database host entry.
  • Save the file

Once all these steps have been completed, your site should be working just fine.

Hey, did you know data can be beautiful too?

wpDataTables can make it that way. There’s a good reason why it’s the #1 WordPress plugin for creating responsive tables and charts.

An actual example of wpDataTables in the wild

And it’s really easy to do something like this:

  1. You provide the table data
  2. Configure and customize it
  3. Publish it in a post or page

And it’s not just pretty, but also practical. You can make large tables with up to millions of rows, or you can use advanced filters and search, or you can go wild and make it editable.

“Yeah, but I just like Excel too much and there’s nothing like that on websites”. Yeah, there is. You can use conditional formatting like in Excel or Google Sheets.

Did I tell you you can create charts too with your data? And that’s only a small part. There are lots of other features for you.

Why you should change the WordPress URL

You might want to change the WordPress site URL for many reasons. Below are some of the common cases.

Case #1 — Moving from a subdirectory

The first case is when a WordPress site moves from a sub-directory to its parent domain. For example:

  • Move from http://example.com/blog to http://example.com

Case #2 — Adding or removing www

In some cases, you will want to change the WordPress URL if you need to remove www or add it to the domain. 

In cases like this, there is a chance an error will occur and you will see “Too many redirects” or “The page isn’t redirecting properly” on your WordPress site.

Case #3 — Adding HTTPS to the URL

If you’re using an SSL certificate, the first part of the URL changes from ‘HTTP to ‘HTTPS.

Case #4 — Moving to a new domain

Changing the WordPress address is also required when a site moves from one fully hosted domain to a different one. For example:

  • Move from http://example.com to http://wpdatatables.com

FAQs about changing the WordPress URL

Why do I need to change my WordPress URL?

Often, it’s a domain transfer kicking off a rebrand, or maybe you’re upping security by switching to HTTPS. Sometimes, there’s a site migration because your old domain just doesn’t fit like it used to, and you’re on the hunt for something that resonates better with your audience.

Can I change my WordPress URL directly from the admin dashboard?

Absolutely. It’s right there under your general settings. Updating the WordPress address (URL) and Site Address (URL) fields does the trick. But don’t bounce just yet, because some underlying housekeeping, like updating internal links, often follows suit.

Will changing my WordPress URL affect my SEO?

It’s like stirring the waters in a still pond. Sure, search engine rankings might wobble. But with proper 301 redirections and updating your Google Search Console, your SEO ship will be back on course, usually stronger than before.

What should I do if I can’t access my WordPress dashboard to change the URL?

No dashboard? No sweat! You can dive into your site’s database update via PHPMyAdmin or tweak the wp-config file. Add definitions for WP_HOME and WP_SITEURL and watch WordPress recognize your new URL like an old friend.

How can I ensure all my content is moved to the new URL?

Consistency is king. Before the big shift, a thorough site backup is your lifeline. Then, employ tools that diligently rewrite URLs across posts, images, and guides you to update site address details without leaving straggling content behind.

What happens to the old URL after I change to a new one?

Think of it as a ghost ship; it’s there but not really. Visitors hitting up the old URL get a message – usually 404 if you haven’t set up 301 redirection. Better to have a redirect plan, so no one’s lost at sea.

How do I handle redirects after changing URLs?

A sturdy .htaccess file is your best mate when you’re charting new waters. This is where you set up those handy 301 redirections, effectively sending visitors and search engines from the old URL to your shiny new one.

Is it necessary to inform Google about the change in URL?

You bet! Update your Google Search Console with the new domain, so Google knows where to send the search party. It also helps to resubmit your sitemap, ensuring that your domain propagation is noticed, and eventually appreciated, by the big G.

How long does it take for the new URL to reflect on the internet?

This is no instant magic; it’s a gradual sunrise. Domain propagation can take anywhere from a few hours to a full 48. During this time, your new address is making acquaintances with servers worldwide.

Will my users be affected by the URL change?

If handled with care? Not much. Most will sail through the URL redirect without noticing the water’s choppier. But there’s always that user experience (UX) element; best communicate the change beforehand, ensuring smooth sailing for your user crew.

Ending thoughts

And here we are, landing smoothly on the other end of your digital leap. If you’ve ever wondered about the ins and outs of revamping your online identity by changing the WordPress URL, consider yourself clued in.

You’re equipped with the lifejackets of 301 redirection, the compass of updating Google Analytics and Search Console, and the map to navigate the world of domain propagation. Breathe easy knowing the SEO considerations for URL change aren’t mythical krakens but manageable waves that you’re now ready to surf.

Remember, a switch in URL is not just about selecting a new nameplate for your site’s front lawn; it’s ensuring that all roads lead home to you – think update site address, think canonical URLs.

Armored with this how-to, you’re not just avoiding the hidden rocks; you’re making waves, setting sail towards new horizons. So, captain, raise your anchor – your next great online adventure awaits.

If you enjoyed reading this article on how to change the WordPress URL, you should check out this one about how to reset WordPress.

We also wrote about a few related subjects like how to add JavaScript to WordPress, how to embed video in WordPress, how to edit HTML in WordPress, how to duplicate a page in WordPress, how to edit WordPress user roles, and how to add WordPress featured image.

And if you want to check out the cool products that we’ve created, we’ve got the best WordPress table plugin out there and the WordPress booking plugin with the smoothest UX.


Bogdan Radusinovic
Bogdan Radusinovic

Senior SEO and Marketing Specialist

Articles: 137