Knowledge base article
Migrate remote transactional website to local server
Related articles
Accessing your site before changing DNS
Domain options for shared hosting
Go live with your WordPress staging website
Other cpanel articles
A beginners guide to email spoofing
Accessing your site before changing DNS
An introduction to email authentication
Basic WordPress security and site management
Can I test out your services for free?
Check MySQL database table disk usage
Configure object cache with memcached and Litespeed Cache plugin
Configure spam filtering in cPanel
Connect via SFTP using SSH key authentication with FileZilla
Connecting to Serversaurus shared hosting via SFTP
Create a clone of your website
Create a SSH key pair and configure your SSH key in cPanel
Create a WordPress administrator via MySQL CLI
Create a WordPress administrator via phpMyAdmin
Create a WordPress cron task in cPanel
Create and manage email accounts in cPanel
Create Autoresponders in cPanel
Disable automatic WordPress updates via wp-config.php
Domain options for shared hosting
Download or restore individual files, directories or database backups with JetBackup
Emptying Trash, Junk and Spam files
Enabling PHP extensions, Changing PHP Version and Setting PHP Options
Export or Import a MySQL database via CLI
Force HTTPS via .htaccess (cPanel)
Go live with your WordPress staging website
Help! I need a backup of my cPanel-hosted website
Hide .html extension using .htaccess
How did my WordPress website get hacked? What do I do?
How to ensure website generated emails are delivered successfully
How to issue a Let’s Encrypt certificate
How to remove Site Software management
I can receive email but can’t send!
Introduction to LiteSpeed Cache
Login to cPanel via the Client Portal
Manage DNS zones with the cPanel Zone Editor
Manual WordPress migrations in a nutshell
Migrate remote staging website to local hosting server
Migrating email from one POP/IMAP email account to another
My site and/or email service is down
Network Firewall (I can’t access my services on a non-standard port)
Pointing your domain to Serversaurus
Pointing your domain to Squarespace with cPanel
Prevent website generated spam with CAPTCHA
Push updates from a staging to production website
Reconfigure production website to subdomain
Recover your hacked WordPress website
Remove Wordfence firewall block via MySQL CLI
Secure your WordPress installation
Setting up email on your iPhone
Subdomains for test sites & more
The SLA – Best effort versus 99.9% versus 100%
Unable to renew certificate: The Let’s Encrypt HTTP challenge failed
Understanding CloudLinux resource limits
Update a WordPress website to use a new domain name
Update your WordPress username via phpMyAdmin
Using the Serversaurus Cloud CDN with your WordPress website
What exactly is shared hosting?
Why don’t you have unlimited plans?
WordPress install still shows Serversaurus “new customer” landing page
This guide will advise steps on migrating a remotely hosted transactional website to your Serversaurus shared hosting server
This migration process ensures complete retention of all data. Part of the migration will involve the website being in maintenance mode to prevent further database entries, you can anticipate the website will be in maintenance mode for about 10 minutes.
To complete this guide, please ensure you have:
- SSH Access - Serversaurus relies on key based authentication to login via SSH/SFTP, if you haven't already, generate your SSH key pair and configure it in cPanel before proceeding with the next steps
- Your cPanel login details - These were included in the original Welcome to Serversaurus or IMPORTANT: Hosting Documentation email which you should be able to find in your inbox otherwise follow these instructions on how to update your cPanel password.
- SSH access to the remote hosts - If the remote host doesn't allow SSH access, we've included a wget command which is FTP compatible. - These can be found within the wp-config.php file.
To prepare for the migration, please reduce the TTL on DNS records to 100 seconds at least 24-48 hours before the migration to ensure quick propagation of the DNS updates.
New to rsync or wget? these helpful command line tools both enable you to import the directory contents from a remote host to your local directory (or vise versa).
Let's begin!
- Open a new terminal window and SSH to your Serversaurus hosting server:
Update the following command with your Serversaurus SSH username and server hostname.ssh username@servername.serversaurus.com.au
- Change into the website document root:
Update the following command with the correct path if requiredcd public_html
- Now let's setup the file sync between the two hosts
Check your present working directory using the following command and store the output for the following steps:pwd
- For users with SSH access - Use the following rsync command to synchronize the remote website directory with your present working directory:
Update the command with your remote host login details and directory path.
rsync -avzh username@remote.hostname.com.au:/path/to/document/root /path/to/present/directory
For users with FTP access - Use the following wget command to recursively import the remote website directory with the path to your present working directory: Update the command with your remote host login details and directory path.
wget -m -x -nH -nv --ftp-user=username --ftp-password=xxxxxxxxxxxxx ftp://remote.hostname.com.au/path/to/document/root
- Correct the ownership and permissions using the following commands:
Update the following command with your Serversaurus cPanel username
chown -R username:username *
Change document root ownership to nobody:
Update the following command with the correct path if required.chgrp nobody ../public_html
Recursively update the directory permissions:
find . -type d -exec chmod 755 {} ;
Recursively update the file permissions:
find . -type f -exec chmod 644 {} ;
- Login to cPanel and navigate to the MySQL Database Wizard function, create your database, user and assign all permissions. Save the database credentials for later reference.
- Update wp-config.php with your database login details. Using vi, edit the wp-config.php file:
vi wp-config.php
Update the following sections with your database login details:
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'your_database');/** MySQL database username */
define('DB_USER', 'database_user');/** MySQL database password */
define('DB_PASSWORD', 'password');
/** MySQL hostname */
define('DB_HOST', 'localhost'); - Put the live website into maintenance mode!
- SSH to the remove host server and generate a database dump:
Update the following command with your remote SSH username and server hostname
ssh username@remote.hostname.com.au
Adjust the below command to include your MySQL username and password. You can find your database login credentials within wp-config.php if required.
mysqldump -u username -p database_name > backup.sql
- Copy the database dump to your Serversaurus server using scp.
Update the following command with your Serversaurus SSH login details and the path to your home directory:scp backup.sql username@servername.serversaurus.com.au:/path/to/home/directory
- Return to your Serversaurus hosting terminal window and import the database. Login to MySQL using the below command, enter your password when prompted:Update the command with your database user
mysql -u username -p;
- Import the database:
Update the following command with the document root path
source /path/to/document/root/backup.sql;
Once complete, exit MySQL:
exit
- To check the migration is successful, access the site before updating the DNS using a host file entry.
- Update the DNS.
- Install a complimentary SSL certificate so your website can be served over a secure connection.
The migration is complete! Nice work!
Troubleshooting recommendations
If you have any warnings/errors, please check for the following common post migration issues
- Login to WordPress and clear all website cache.
- Check DNS is resolving to correct server IP address.
- Login to phpMyAdmin, check wp_options table and confirm the siteurl and home are pointing to the correct domain name- update if required.
- Check all PHP dependencies are enabled.
Last updated November 30, 2023