WordPress does give you opportunity to change the sites’ URLs, but I should note, that it can be harmful for your site and is not recommended. Anyway, let’s see some ways to do that.
“WordPress Address (URL)” and “Site Address (URL)” are important settings, as they control where WordPress thinks your site is located. They control the display of the URL in the admin section of your page, as well as the front end, and are used throughout the WordPress code.
The “Site Address (URL)” setting is the address that you want people to type in their browser to reach your WordPress blog.
The “WordPress Address (URL)” setting is the address where your WordPress core files are situated.
Sometimes people need to manually change (or fix) these settings. Usually this happens when they change one or both of them and they discover that their site no longer works properly. This can make user have no easily discoverable way to correct the problem.
There are 4 easy methods to change the Site URL manually. Any of these methods will work and perform like same function.
1 . Edit wp-config.php
You can set the site URL manually in the wp-config.php file.
Just add these two lines to your wp-config.php, where “example.com” is the correct location of your site:
This is not the best fix, it’s just hard coding the values into the site itself. You can’t edit them on the General settings page anymore when using this method.
2 . Edit functions.php
This method will help you quickly get a site back up and running, if you changed those values incorrectly, and you have access to the site via FTP.
- Just FTP to the site, and get a copy of the active theme’s functions.php file. You are supposed to edit it in a simple text editor and upload it back to the site.
- Add these two lines to the file, just after the initial “<?php” line.
update_option( ‘siteurl’, ‘http://example.com’ );
update_option( ‘home’, ‘http://example.com’ );
Use your own URL instead of example.com, obviously.
3 . Upload the file back to your site, in the same location. FileZilla offers a handy “edit file” function to do all of the above rapidly; if you can use that, do so.
4 . Load the login or admin page a couple of times. The site should come back up.
These were some ways to change the URL of sites. I hope this article was helpful for you.