How to change the WordPress URL and why would you want to do that?
A WordPress site URL is automatically created when you create a new page.
Since WordPress uses the titles to create WordPress URLs, you will often end up with a WordPress URL that you actually wanted. However, if you are not happy with the site URL, you can easily change it and today we are going to teach you how to do it.
There are many reasons why one wants to edit the WordPress site address. You can change the WordPress site URL to optimize it for search engines, to make it simpler and memorable, etc. We will talk some more about the reasons why you’d want to do that a little bit later.
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.
There are some effective methods and we will touch on them in a moment.
But first, let’s cover the common reasons why you would change your WordPress URL.
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
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 WordPress 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.
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’
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.
FAQs about changing the WordPress URL
1. How do I change the URL of my WordPress site?
You must get into the WordPress dashboard and go to the General Settings page in order to modify the URL of your WordPress website. Using the new URL of your website, you may update the WordPress Address (URL) and Site Address (URL) fields here. The URL of your website will be modified after you save the modifications.
2. What are the steps involved in changing the URL of my WordPress site?
Accessing the WordPress dashboard, going to the General Settings page, altering the WordPress Address (URL) and Site Address (URL) sections, saving the changes, and updating the links on your website are the steps required to change the URL of your WordPress site.
3. Will changing my WordPress site’s URL affect my search engine rankings?
Indeed, changing the URL of your WordPress site can impact how well it performs in search results. You must implement suitable redirects from the old URL to the new URL and notify Google of the changes by uploading a sitemap and updating your site in Google Search Console in order to prevent negative effects.
4. How can I redirect the old URL to the new one after changing my WordPress site’s URL?
You can manually set up redirects in your site’s .htaccess file or use a plugin like Redirection to switch from the old URL to the new one. By doing this, you can make sure that any users who attempt to access your website using the old Address are immediately forwarded to the new one.
5. Can I change my WordPress site’s URL without affecting my site’s content?
By taking the right actions and setting up the right redirects, you can change the URL of your WordPress site without having an impact on the site’s content. But, you will need to manually update any links that are hard-coded into your text.
6. What should I do if I encounter issues after changing my WordPress site’s URL?
If you experience problems after changing the URL of your WordPress website, make sure you took the right steps and configured the right redirects first. Also, you might try emptying the cache on your web browser and asking your web host or developer for help.
7. How do I update the links on my WordPress site after changing the URL?
You can manually search and replace the old URLs with the new URLs in your site’s database or use a plugin like Velvet Blues Update URLs to update the links on your WordPress site after updating the URL.
8. Is it necessary to update the site and home URLs in WordPress after changing the URL?
Absolutely, after updating the URL, you must update the site and home URLs in WordPress. This guarantees that your site will work properly and that all internal links and media URLs are updated to the new URL.
9. How long does it take for changes to take effect after changing the WordPress site’s URL?
As soon as you save the changes on the General Settings page, your WordPress site’s URL should reflect the changes. It might take some time, though, for search engines to update their indexes and take note of the changes.
10. Can I change my WordPress site’s URL back to its original one if I encounter issues after changing it?
If you experience problems after changing the URL of your WordPress site, you can change it back to the original one. But, in order to prevent breaking any links or creating problems for visitors, you must make sure that you put up suitable redirects from the new URL to the old URL.
Ending thoughts on how to change your WordPress URL
Can you change your WordPress URL? Yes, you can and there are numerous reasons to do this.
In this article, we explained how to change your WordPress URL and why and we pointed out some details to keep in mind when trying to WP config site URL.
As long as you follow our little manual, you should be able to change domain WordPress quickly and easily.
If you enjoyed reading this article on how to change WordPress URL, you should check out this one about how to reset WordPress.