Sometimes you need to migrate your WordPress website, or change the location of your WordPress installation.These settings can be adjusted directly in the WordPress admin dashboard from Settings >> General or you can make these modifications to your wp-config.php file and directly in the database as well.
Change WordPress address in admin dashboard
If you want to change WordPress website URL, you can do it in Dashboard at http://yourdomain/wp-admin.
1. Log in to WordPress admin panel Settings > General.
2. Update WordPress Address (URL) line and Site Address (URL) lines and save the changes:
This method will typically work if you haven’t moved your WordPress installation and aren’t having any issues access it.
3. You will also need to re-generate the permalinks to make sure they have the new URL in Settings >Permalinks and set it to default .
Change WordPress address with wp-config.php file
The easiest way to modify your WordPress URLs is the wp-config.php file.
- Edit your wp-config.php file.
- Define your WP_HOME and WP_SITEURL settings by adding these lines at the top:
Then simply load your site from its new location,it should work fine now.
Change WordPress address directly in the Database
If Dashboard is not opening or not letting you in for some reasons, you can perform the changes directly in MySQL database.
- Login to your cPanel and navigate to phpMyAdmin menu.
- Choose the database which is being used for your WordPress blog and click on it.
- Click on wp-options table and edit siteurl and home fields.
- Enter in your new value in the option_value field, then click Go
Go back to your website and refresh the page to check the results.