Moving a website to a new server can feel risky.
Your website may contain years of content, customer information, uploaded images, databases, forms, and important configuration files. The last thing you want is to move everything to a new server and discover that something is missing.
In this first part of our three-part website migration series, we will go through preparation for a server migration, identify what needs to be moved, create reliable backups, and get the new server ready.
The goal is simple:
Before we move the website, we make sure we can recover it.
Website migration is the process of moving a website from one hosting server to another.
You may need to migrate a website because:
At first, website migration may sound like simply copying files from one server to another.
In reality, there is more to it.
A typical website can contain:
This is why proper preparation is important.
Before making any changes, take a moment to understand your website.
Essential questions include:
Where are my website files stored?
For a typical cPanel account, they may be inside:
Does the website use a database?
WordPress, Joomla, Drupal, and many custom PHP websites usually use MySQL or MariaDB.
Does the website have email accounts?
If your domain also hosts email, you need to consider those accounts separately.
Where is the DNS managed?
Your DNS may be managed through your registrar, Cloudflare, your current hosting provider, or another DNS provider.
Knowing these details before starting will make the actual migration much easier.
You do not need many tools to get started, but you do need access.
Make sure you have:
You should have:
If you are moving between two cPanel servers, the process can be even simpler because both environments provide many of the tools needed for the migration.
Before creating backups, check how large your website is.
If you have SSH access, you can use:
You might see:
This tells you that the website files are using approximately 2.4 GB of storage.
You should also check how much space is available on the new server.
There is no point starting a migration if the new server does not have enough storage.
You can check available disk space with:
Look for the available space on the filesystem where your website will be stored.
Now we get to the most important part: the backup.
Before moving anything, create a complete copy of your website files.
If your website is located inside public_html, you can create a compressed backup using:
Let's break that command down.
tartar is a Linux utility used to package files and directories into an archive.
-cCreates a new archive.
-zCompresses the archive using gzip.
-vDisplays the files being processed.
-fSpecifies the name of the output file.
The result is:
This file contains your website files in a compressed format.
Check the file:
You should see something similar to:
The exact size will depend on your website.
You can also inspect the contents without extracting the archive:
You should see entries from your website directory.
For example:
This gives you some confidence that the archive contains the files you expect.
Your website files are only half of the migration.
If your website uses a database, you need to back that up too.
For a MySQL or MariaDB database, you can use:
For example:
The command will ask for the database password.
Once completed, you should have:
This file contains the database structure and data required to restore the website's database.
Check the file:
You can also inspect the beginning of the SQL file:
You should see SQL statements describing the database.
For a larger database, the backup file may be quite large. That is normal.
The important thing is that the file exists and was generated successfully.
Do not keep your only backup on the server you are trying to migrate away from.
Imagine this:
Old server fails → backup is stored on old server → backup is lost → migration becomes a recovery operation.
That is exactly what we want to avoid.
Download or copy your backups to another secure location.
You should ideally have:
Your second copy could be stored on secure external storage, another server, or another backup system.
Before moving the website, record the important configuration details.
For a WordPress website, one of the most important files is:
This file contains information such as the database connection details.
You may see settings similar to:
Do not publish or share your real password.
You are simply recording the information you will need when connecting the website to the database on the new server.
For a custom PHP application, look for configuration files such as:
The exact filename depends on how the website was developed.
The old server might be running one PHP version while the new server uses another.
Check the current PHP version:
You may see:
Make a note of it.
If the website depends on a specific PHP version or extension, make sure the new server supports it before you move the website.
This is particularly important for older WordPress websites and custom PHP applications.
DNS tells the internet where your website is hosted.
Before changing anything, find out where your DNS is currently managed.
You should know:
www recordFor example:
Later, we will change this to:
Do not change the DNS yet.
We will handle that in Part 3 after the new server has been tested.
Now that your backups are safe, you can start preparing the new server.
If you are using cPanel, create the website account or add the domain.
Make sure the document root is correct.
A common cPanel path is:
If you are using a VPS, your website might instead use:
The exact location depends on your server configuration.
Also confirm that the new server has the software your website requires.
For example:
At this point, we have not moved the website yet.
We have:
In Part 2, we move from preparation to the actual migration.
We will take the backups we created here and move them to the new server.
We will cover:
rsync as another optionThe important thing is that we will not change the DNS yet.
The old website will remain available while we prepare and test the new server.
How I Migrated a Website to a New Server – Part 2: Moving Website Files & Database
Once the new server is ready, we can safely move the website and database without sending visitors to it just yet.
African Script — helping businesses build, manage, and move their digital platforms with confidence.
Your email address will not be published. Required fields are marked *
Comments