You may want to migrate WordPress site from one hosting to another hosting or simply from local server to live server. There are various techniques when you try to Migrate WordPress site to another URL. This can be done by manual installation or using different available plugins in the Repository. It’s a nail-biting task when it comes to migrating to a new server. However, if you’re not familiar with WordPress Migration, I recommend you to Backup Your Themes, Plugins, and Database before proceeding any further.
Many people who own websites are forced to move to a new host because of certain issues with their current provider and have a better one. But most of the time, people face issues while migrating to the new host. If not done efficiently, the site will be damaged or it comes up with certain errors.
If you own your very own website and spend some time preparing for it, then migration to a new server is nothing to be concerned about. Thousands of wWordPresssites are migrated to new hosting servers every day. It can be a pretty amazing project if followed the steps correctly.
Basically, you’d need to do the following steps while migrating wp site to new URL:-
- Download your old wp-content folders and database from the old server.
- Install the latest version of WordPress to the new server. Create FTP client for this, and upload the WordPress. It will be more simpler and easier to customize.
- Create a new database from Cpanel. Create a new database user and assign username and password too. Then import the old DB on the newly created database.
- Import the all the wp-content folders.
- Update the URLs via SQL. This step is necessary. See the below code.
- Run the migrate query in SQL ( if necessary )
Here’s the query you need to run in your SQL.
Note: Use the following query only if you’re moving the site from old site URL to new site URL
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldsite.com', 'http://www.newsite.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldsite.com','http://www.newsite.com');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldsite.com', 'http://www.newsite.com');
UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://www.oldsite.com', 'http://www.newsite.com');
Note: don’t forget to change your
Read More about how to create new admin account via MySQL in WordPress here