Do you need to change your WordPress URL? 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 will need to know how to change your WordPress site URL.
The WordPress address and site address are extremely important fields because they reference the address of your website on the internet and the location of your website files.
In this article, we will share four different ways to easily change your WordPress site URLs (step by step). This guide will specially come in handy when you are fixing common WordPress errors or moving a WordPress site.
Why Change WordPress Site URLs?
There are many reasons why you might need or want to change your WordPress URL. For example:
- You may need to update site URLs when moving WordPress from 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 WordPress url.
- You will also need to change it when moving WordPress from HTTP to HTTPs.
Apart from that, you may need to change the WordPress address settings if you are seeing too many redirects error in WordPress or when troubleshooting another WordPress error.
WordPress Address vs Site Address
When changing WordPress site URL, you will need to update two separate settings: WordPress Address and Site Address.
This can be confusing for many beginners because they don’t know what’s the difference between the two settings.
Your WordPress Address (URL) is the address where WordPress files and folders are stored including your admin pages, media files, plugins, themes, etc.
Your Site Address (URL) in WordPress is the public facing part of your website. This is what your visitors will type in to reach your website. This is also the link that you put on your business cards.
For majority of users, the WordPress Address and Site Address URL will be the exact same link.
However in some cases, large companies may host their WordPress site on a different server because their corporate website has many other applications, and they want to isolate where each app is hosted.
But for majority of users, these two WordPress URLs need to stay the same.
That being said, let’s take a look at how to easily change WordPress site URLs. We will show you the following methods, and you can choose the one that works best for you.
- 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
Ready? let’s get started.
Method 1. Change WordPress Site URLs from Admin Area
This method is the easiest. If you can already access the WordPress admin area, then we recommend using this method.
Simply login to your WordPress website and go to Settings » General page. From here you can change WordPress site URLs under the ‘WordPress Address’ and ‘Site Address’ options.
WordPress Address and Site Address are usually the same address.
Don’t forget to click on the ‘Save Changes’ button to store your settings. You can now visit your website to make sure that everything is working OK.
Method 2. Change WordPress Site URLs Using functions.php File
This method is recommended for users who cannot access the admin area of their WordPress website.
Simply connect to your WordPress site using an FTP client and go to /wp-content/themes/your-theme-folder/.
From here you need to locate the functions.php file and edit it using a plain text editor like Notepad or TextEdit.
Next, you need to add the following code at the bottom:
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 website hosting using FTP.
You can now 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 option for site URLs every time your functions file is loaded.
Once everything gets back to normal, don’t forget to remove the two lines of code from your WordPress functions file.
Method 3. Change WordPress Site URLs Using wp-config.php File
This method is only recommended if you are unsure which WordPress theme you need to edit or cannot find the functions.php file.
For this method, you will be adding the site 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.
Simply connect to your website using an FTP client and edit the wp-config file. 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.
First, you need to make a WordPress database backup. This step is really important and will help you undo database changes in case anything goes wrong.
After that, you need to go to your web hosting account’s dashboard and click on the phpMyAdmin icon under the Databases section.
Note: Our screenshot is from Bluehost but most other WordPress hosting companies will also have the ability for you to edit database settings.
Once you click the link, it will launch the phpMyAdmin app, which provides a web-based interface to edit MySQL databases. To learn more about it, see our guide on how to WordPress database management with phpMyAdmin
Inside phpMyAdmin interface, you need to click on your WordPress database from the left column. The app will now display tables inside your WordPress database.
Next, you need to scroll down to the options table. By default the database prefix is wp_ but since you can change WordPress database prefix, your screenshot may have a different prefix.
PhpMyAdmin will now display the rows inside the options table. You need to locate the rows where option_name is siteurl and home.
Next, click on the pencil icon on the left to edit each row and change the option_value field to the new site URL. After that, click on the tiny Go button at the bottom right corner to save your database changes.
You can now visit your website to see if everything is working fine.
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 have answered many different questions related to changing WordPress URLs. Below are some of the most frequently asked questions.
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 that the URLs are hard coded in the wp-config.php file.
To change your WordPress URL, you will need to follow method 3 in our article 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 WordPress URL and Site Address settings from the WordPress admin area. To recover from that, you will have to follow our guide above to change the WordPress URLs back using functions.php, wp-config, 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 either use the Velvet Blues Update URLs plugin or the Better Search Replace plugin.
When you change your WordPress URL, you will need a way to bulk update links through your WordPress posts, pages, and other areas in your database. The above plugins are a huge time saver.
Aside from using them to update URLs when moving websites, we also use them for various other platform migrations such as moving from WordPress.com to WordPress.org, Blogger to WordPress, Weebly to WordPress, etc.
We hope this article helped you easily change the WordPress site URLs. You may also want to see our guide on the must have WordPress plugins, and how to speed up WordPress.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
The post How to Change Your WordPress Site URLs (Step by Step) appeared first on WPBeginner.