Changing The Site URL in WordPress
There are some easy ways to manually change a site's URL. Either of these methods will work and perform almost the same function.
1.
Edit wp-config.php
It is possible to set the site URL manually in the wp-config.php file.
Add these two lines to your wp-config.php, where “example.com” is the correct location of your site.
|
|
This is not necessarily the best fix, it’s just hard-coding the values into the site itself. You won’t be able to edit them on the General settings page anymore when using this method.
2.
Changing the URL directly in the database
If you know how to access phpMyAdmin on your host, then you can edit these values directly to get your site up and running again.
- Backup your database and save the copy off-site.
- Login to phpMyAdmin.
- Click the link to your Databases.
- A list of your databases will appear. Choose the one that is your WordPress database.
- All the tables in your database will appear on the screen.
- From the list, look for
wp_options. Note: The table prefix ofwp_may be different if you changed it when installing. - Click on the small icon indicated as Browse.
- A screen will open with a list of the fields within the
wp_optionstable. - Under the field
option_name, scroll down and look forsiteurl. - Click the Edit Field icon which usually is found at the far left at the beginning of the row.
- The Edit Field window will appear.
- In the input box for
option_value, carefully change the URL information to the new address. - Verify this is correct and click Go to save the information.
- You should be returned to your
wp_optionstable. - Look for the
homefield in the table and click Edit Field. Note There are several pages of tables insidewp_options. Look for the>symbol to page through them. - In the input box for
option_value, carefully change the URL information to the new address. - Verify this is correct and click Go to save the information.
3. WoprdPress Plugin "Go Live Update Urls"
Update URLs After Moving a WordPress Site
The easy way to update old url on your website is by using the Go Live Update Urls plugin for WordPress.
It is a free WordPress plugin that lets you update URLs in your posts, pages, images, excerpts, widgets, and more.
However, make sure that you have a complete backup of your WordPress site before updating all the links. This will allow you to easily revert back in case something goes wrong during the update process.
Next, you will need to install and activate Go Live Update Urls on your site. For more details, see our step-by-step guide on how to install a WordPress plugin.
Upon activation, you should navigate to Tools » Go Live from your WordPress admin panel.