November 22, 2019 at 9:26 am #80970ChinomnsoParticipant@chinomnso-ugwuanya
When you migrate a WordPress site from your development server to a production server, or from one server to another, the new installation carries URLs from the previous installation. If left that way, your site would not load properly. You may get a blank white page, a 500 Internal Server error, or some other nasty errors.
Read on to learn how to safely change the URLs in the database. Please note, however, that I’m writing this assuming you have correctly copied all your files from the previous server to the new.
First, using a database client like PHPMyAdmin, export the old database from the previous server to a .sql file. Then, create a new database on the new server. Be sure it corresponds to what you have defined in your wp-config file.
Import the .sql file you generated when you exported the old database from the previous server into the new database you’ve just created. Copy the code below, replace
http://old.urlwith the old URL,
http://new.urlwith the new URL, paste them in your database client and run.1234567UPDATE wp_options SET option_value = replace(option_value, 'http://www.old.url', 'http://www.old.url') WHERE option_name = 'home' OR option_name = 'siteurl';UPDATE wp_posts SET guid = replace(guid, 'http://www.old.url','http://www.new.url');UPDATE wp_posts SET post_content = replace(post_content, 'http://www.old.url', 'http://www.new.url');UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.old.url','http://www.new.url');
Note that the default table prefix for a new WordPress installation is wp_. Be sure to change this to correspond with what you have on your database. The queries above change URLs of pages, media files and virtually anything on your site that needs a URL to function properly.
If you encounter any difficulties trying to change WordPress URLs after migrating, drop it on this thread. I’ll hang around to answer your questions.
You must be logged in to reply to this topic.