How to transfer a large WordPress site from one host to another… like a pro

John Flash, MD
7 min readDec 5, 2020

In reality, there are many ways to transfer your wordpress site, and I believe one of the most common approaches is to use a Wordpress plugin that downloads the entire content of your site into a zip file, which you can then upload to the new host using the same plugin.

But what if you have a really large site with gigabytes of data? ( I’m not sure how you got there, but it happens) or imagine you have incredibly slow internet and the zip file is some hundreds of megabytes, or you just cannot afford the luxury of time it would take to download and then re-upload a 500+mb zip file… Then this is for you.

I would assume you have Cpanel based hosts serving as your origin and destination servers. Nevertheless, the same techniques would still apply to any other kind. Let's call our origin and destinations site1.com and site2.com respectively.

Step 1: Package the files

Your Wordpress site has lots of files so we obviously want to compress them into a single zip file that can easily be transferred to your new server.

Select all of the files shown above (at least) and compress them into a zip file. Let’s call it ‘site1-wp.zip’. To confirm that this file is accessible to your destination server, try to access it in your browser by typing your site address and the filename.

e.g https://site1.com/site1-wp.zip

This should automatically start the download of your zip file which you can immediately cancel. Keep this URL in a notepad somewhere.

Step 2: Transfer the files

On your destination server (site2.com), login to your cpanel account.
Type ‘ssh’ or ‘terminal’ into the search bar and click ‘terminal’.

If you see a warning like the image below, don’t be afraid, I’m with you (as long as you stick to the instructions).

You should eventually see an ssh terminal window that looks like this.

Type “ls” and hit enter. You should see a list of all folders in your current location.

If you haven't tampered much with your new Cpanel account, it's expected you should get something similar.

Next type “cd www” and hit enter. This command should take you into the root folder of your site2.com. Type “wget {zip file url}”

$ wget https://site1.com/site1-wp.zip

With this, you are transferring your large zip file from your old server to your new server directly over the internet saving you the trouble of downloading and re-uploading.

Once this process is completed, you can safely return to your Cpanel file manager, check the public_html or www directory and your zip file should be there. Extract this zip file and all your files from the old site are now ready to be served

Step 3: Prepare the database

I’m sure you are pretty much aware that there’s no Wordpress site without a database. Hence, you have to also transfer your database from the old server to the new one.

There are many ways to go about this, but we’ll be doing the simplest of them. This involves exporting all the data into a single file and importing this file into the new server. For the average Wordpress site, the compressed export of the database doesn’t usually exceed a few Megabytes, so you should be fine.

We would do this using the one and only phpmyadmin.

On your source server, open phpmyadmin, you might see a list of databases on the left pane. You need to click the one that belongs to your wordpress site. If you see just one, then you’re in luck, click that one.

Incase there are multiple databases and you are not sure which belongs to the wordpress site, go check the wp-config.php file of your wordpress folder and look for define(‘DB_NAME’, ’****’), the **** is the name of your db.

After selecting the database, you should see an export button on the right

Select custom and ensure all tables, structure, and data are selected. This should be by default anyway.

Change compression to zipped or gzipped, this would compress the output file to reduce file size. You can leave every other setting as default, and click the “go” button at the bottom of the page.

This should start a download of a file automatically. Like earlier said, this file should be a few MBs and download within a few minutes.

If it seems like your database is really large and the download is taking a while, you might be better off using the second method. Hit me up on twitter @drflash360 and i’l create a guide for that.

Step 4: Setup the new database

Once you have the exported file, head over to the cpanel of your destination server and create a new MySQL database taking note of the database name along with the username and password attached to it.

If you’re not sure how to do this, here is a tutorial.

Open phpmyadmin on your destination server, select the new database you just created and click the import button (usually beside the export button). You should see a “choose file” box where you can select the exported file, then click “go”.

This would, as the name suggests, import the database into this new server.

I can imagine you’re wondering, “are we there yet?” Yup, that’s it …

psyche! :)

Don’t worry, you’re almost there.

Once the importation is completed, you need to do 3 things

1. Change the site URL

In phpmyadin, Click on your newly imported database, look for the wp_options table.

If you created your original site using some other tools, the name might be slightly different, but it would look like ‘**_options’ where ** can be any weird prefix that is consistent across all other table names.

Click on this table and you should see some data.

You are concerned with the rows containing siteurl and home. Double click to edit their values from your old site’s URL to the domain/URL of the new server.

2. Update your wp-config

Via the cpanel file manager on the new host, edit the wp-config.php file. Change the lines that look like

define( 'DB_NAME', '***' );define( 'DB_USER', '***' );define( 'DB_PASSWORD', '***' );

Ensure the ‘***’ contain the settings of your new database (which you took note of in the beginning). Save this file now and try access your wordpress site on the new domain.

If you followed all the steps properly, you should see your home page working like nothing changed.

3. Update your permalinks

Access your wp-admin dashboard, go to settings -> permalinks and click the save button. This will update your websites permalinks structure.

That’s It! You just migrated your wordpress site like a pro!

Fun, right?

Feel free to drop comments or questions if you have any and don't forget to share, you might just save someone’s day.

Thanks for reading.

--

--