Safety Move WordPress site to new hosting

126 Likes Comment

Steps by steps, safety migrate your whole wordpress website to new domain/hosting.

 1. Backup data and files of current website:

+ In Hosting cPanel, go FTP Files, select folder of website, choose compress

Backup old data files

+ To backup database, go databases — phpmyadmin — select website database name — export — save the exported database files.

Backup Database

2. In new hosting site:

+  Addon new domain to hosting, create database name + database user for new site.

+ Copy current website data files to new hosting, import current database to new site.

3. Update the current website url to new url in every posts and configuration.

In phpmyadmin run following SQLs:

UPDATE wp_options SET option_value = replace(option_value, ‘http://www.oldwebsite.com’, ‘http://www.new-nguyenkhaclong.com’) WHERE option_name = ‘home’ OR option_name = ‘siteurl’;
UPDATE wp_options SET option_value = replace(option_value, ‘http://oldwebsite.com’, ‘http://new-nguyenkhaclong.com’) WHERE option_name = ‘home’ OR option_name = ‘siteurl’;
UPDATE wp_posts SET guid = replace(guid, ‘http://www.oldwebsite.com’,’http://www.new-nguyenkhaclong.com’);
UPDATE wp_posts SET guid = replace(guid, ‘http://oldwebsite.com’,’http://new-nguyenkhaclong.com’);
UPDATE wp_posts SET post_content=(REPLACE (post_content, ‘oldwebsite.com’,’new-nguyenkhaclong.com’));

Bonus tips: for testing purpose, you can defined the wordpress site url just in wp-config.php

define( ‘WP_HOMEURL’, ‘http://yourwebsite-url.com/’ );
define( ‘WP_SITEURL’, ‘http://yourwebsite-url.com/’ );

Reset WordPress Admin password by using sql update query:

UPDATE wp_users SET user_pass = MD5(‘LongShared’) WHERE ID=1;

You might like

Avatar

About the Author: Toc Xoan

Leave a Reply

Your email address will not be published. Required fields are marked *