How to Migrate WordPress site to another URL

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:-

  1. Download your old wp-content folders and database from the old server.
  2. 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.
  3. 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.
  4. Import the all the wp-content folders.
  5. Update the URLs via SQL. This step is necessary. See the below code.
  6. Run the migrate query in SQL ( if necessary )
ALSO READ  How to Add Custom attributes in WordPress Nav Menu

Migrate WordPress site to another Url

 

Immigration is legal in WordPress!! Click To Tweet

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 table_prefix

Read More about how to create new admin account via MySQL in WordPress here