If you transfer your WordPress site from the localhost to the server, or from one domain to another, the site will not load. This is because the absolute path URL is still pointing to your localhost or other domain. Change the site URL and the home URL in order for the site to work.
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl.com', 'http://www.newurl.com') WHERE option_name = 'home' OR option_name = 'siteurl';
Then after migrating from localhost, or the other domain, you will need to fix the URLs for the GUID (Globally Unique Identifier) field in wp_posts table. This is critical because GUID is used to translate your post or page slug to the correct article absolute path if it is entered incorrectly. The database query is:
UPDATE wp_posts SET guid = REPLACE (guid, 'http://www.oldurl.com', 'http://www.newurl.com');
WordPress uses absolute path in the URL (link) instead of a relative path in the URL when storing their data in the database. Within the content of each post record, it stores all the old URLs referencing the old source. Therefore you will need to change all these URLs to the new domain location. The database query is:
UPDATE wp_posts SET post_content = REPLACE (post_content, 'http://www.oldurl.com', 'http://www.newurl.com');