Safety Move WordPress site to new hosting

9 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/’ );

 

You might like

About the Author: Toc Xoan

This guy likes taking photos, hunting cheap tours, exploring the unique culture of every cities of Vietnam. Contact: [email protected]