There are many reasons why you may have to change your WordPress site URL. Maybe on changing domains, moving on HTTP to HTTPs, on local server to live site, etc.
Whatever it is, you have some options when it comes to changing the URL. Today in this article I will tell you different ways to change the URL of a WordPress site.
How to Change WordPress Site URLs
Below are the different methods to change the WordPress URL. But keep in mind one small mistake can down your site completely.
http://distancestudio.com/wp-content/mu-plugins/db-safe-mode.php So let’s start…
1. Change the URL from Admin Dashboard
If you are able to log into your WordPress dashboard, this is the easiest and best way.
Just login to your WordPress website and go to the Settings >> General page. Here you can change the URL of “WordPress Address” and “Site Address”.
After changing your WordPress URL, do not forget to click on the Save Changes button. Now you can visit your site whether everything is working properly or not.
2. Change the WordPress URL from functions.php
Simply connect your WordPress site to the FTP client and go to / wp-content / themes / your-theme-folder / and find the file Functions.php.
Then paste the below code into the Functions.php file below.
update_option (‘siteurl’, ‘https://example.com’);
update_option (‘home’, ‘https://example.com’);
Use your own URL instead of example.com.
Now you can save your changes and upload the file again on your website hosting using FTP.
Now you can visit your site to check that everything is fine.
Note: Do not leave this code in the functions.php file. Once the site is running, remove them.
3. Change the URL from wp-config.php File
Just connect your site to an FTP client and edit the wp-config file. Then call the code below ‘That’s all, stop editing! Paste over Happy publishing ‘.
define (‘WP_HOME’, ‘https://example.com’);
define (‘WP_SITEURL’, ‘https://example.com’);
Replace https://example.com with your domain name.
Now save your changes and upload the file to your server again.
3. Change the WordPress URL from Database
You can use phpMyAdmin in a WordPress database to change the WordPress URL.
You can open the PhpMyAdmin, click on the database on the left. side Scroll down and click on the “wp_options” table then wp56_options.
By default, the database prefix remains wp_, but if you changed the database prefix for better security, there will be a different prefix.
You can edit both the values of “site URL” and “home” rows.
Click on the pencil icon and change option_value to the new site URL. After that, click on the Go button at the bottom right corner to save the changes.
I hope this article helped you change the URL of your WordPress site.
Small request, if this post has proved helpful for you, then don’t forget to share it!