Wordpress has a interesting oddity, it stores site path with domain name in its settings in database. If you are moving your WP site, you have to change that setting before! I do not judge is it a good or bad decision, but it works this way.
If you forget to change Siteurl, WP installation won't work on new location. Here is how to fix it!
# Change the database - wp_options
First way is to enter phpMyAdmin on your hoster find table wp_options in database, search for option_name eq to siteurl and home and modify it there.
# Quicker way - change the wp-config.php
Quicker way is to modify wp-config.php and put there new lines
define('WP_HOME','http://yourhost.com'); define('WP_SITEURL', WP_HOME);
Replace yourhost.com with your site domain name. These lines will make sure WP uses right URL.
This quicker way is also useful when you download your client website to your localhost for development and need to change URL to your local site.
# Another way - use relocate feature
WordPress supports an automatic relocation method intended to be a quick assist to getting a site working when relocating a site from one server to another.
Follow this steps:
- Edit the wp-config.php file.
- Insert a new line define('RELOCATE',true);
- Point your web browser to login URL like http://www.mynewdomain.com/wp-login.php and login as usual
- Verify that you have, indeed, logged in to the correct server.
- Navigate to Settings > General and verify that both the address settings are correct. Remember to Save Changes.
- Edit wp-config.php and remove line added in (2)