What's new

Moving WordPress from One Host to Another with cPanel Access

chris

Top Contributor
This article was written by DNTrade member @johno69 (Paul), the founder and project manager at Illawarra Web Design. Paul has been working in web development for over 12 years. A big thanks to Paul for sharing this!

---

Moving WordPress from One Host to Another with cPanel Access

I often get asked this question, how can I move my WordPress website from one host to another?

Generally a cPanel transfer from the old host to the new host will work for you and you can contact your new host and ask them to help with that.

There are often reasons why that is not the best way to go. Are you wanting to move a site you have set up as an addon domain but want to leave the root site where it is? that’s just one reason you will need to do this manually. So here are some steps to help.

Today i’ll go through the steps for you if you DO have cPanel access to the old server. Later I will cover how to do the same without cPanel access the the old server.

Essentially it’s just a matter of backing everything up, and moving it. Sounds easy right? Well it’s easy when you know how.

Because you are not changing the URL there are no real changes you need to make to any settings before backing up.

Step 1: Back up the files.

In cPanel go to File Manager, in the public_html folder, select all, compress.



Then it’s just a matter of downloading the zipped file.

Step 2: Export the Database.

We need to log in to phpMyAdmin for this one. Once you are in phpMyAdmin, select your database from the databases on the left. Once you have the database tables visible, simply click the Export button at the top.



From the next screen you will need to complete the export, and download the file.



Now we have everything we need to move the site to the new host.

Step 3: Uploading the files

On the new server, you need to go back into file manager and upload the zip file you downloaded before. Then extract the zip file into the public_html folder.

Step 4: Create a new Database

On the new server, within cPanel, go to MySQL Databases and create a new database. Write down the database name.

Create a database user, write down this name and password too.

Add the database user to the database and give them all privileges.



Now we have a new database, new database user, new database password.

Step 5: Import Database

In just the same way we exported the database on the old host server, we now complete the import into the new database on the new host server.

Go into phpMyAdmin on the new server, select your new database, click Import.

Simply browse for the SQL file you downloaded before, and import.



Step 6: Link new Database to WordPress.

There is one file that you need to edit to tell WordPress you now have a new database.

In file manager in cPanel (new server), click on wp-config.php and then edit, you will need to update the database name, username & password to be the ones you set up on the new server database when you created it.



Step 7: Update your Domain Name Servers

The last step is just that, head over to your registrar and update the DNS of your domain name to point to the new server.

Now once the DNS has propagated you will have your website on the new server.

Finishing Tip

As a note, you may want to log in to the old server website and make a post, or change some text on the old server AFTER you complete the move, but before you change the DNS to be able to tell when the DNS has changed over. I usually just add an extra word into the content or something similar.

Happy moving!
 

Attachments

  • move-wordpress-1.png
    move-wordpress-1.png
    116.5 KB · Views: 85
  • move-wordpress-2.png
    move-wordpress-2.png
    258.8 KB · Views: 83
  • move-wordpress-3.png
    move-wordpress-3.png
    11.4 KB · Views: 84
  • move-wordpress-4.png
    move-wordpress-4.png
    12.4 KB · Views: 83
  • move-wordpress-5.png
    move-wordpress-5.png
    41.3 KB · Views: 83
  • move-wordpress-6.png
    move-wordpress-6.png
    16.2 KB · Views: 84

Christopher

Top Contributor
Great explanation @johno69 !
I read that allowing all privileges to the database wasn't a good idea for security, is that true?
and
Am I correct in thinking this doesn't move the emails that are in my account over to the new account either and I have to move them another way?
 

Joel

Top Contributor
The method listed above is great for moving the site by itself. It doesn't move anything else on the hosting account, including email accounts, forwarders, other MySQL databases, etc.

If you wish to move email accounts and you're on cPanel, it's super easy by using the built in cPanel transfer tools. Using this method you'll probably only need to update nameservers to get it back up and running.
 

helloworld

Top Contributor
Cpanel back up wizard seems like an easier option.

I would add a Step 6A

Test your Site
Now that you have moved your website across to your new web host you will want to check it is working before updating your Nameservers so that you can check and fix any errors that may have occurred during migration.

In Windows go to C:windows/system32/drivers/etc/hosts
Open the hosts file
At the bottom add the following line
123.123.123.1 www.yourdomain.com.au

Replace the above numbers with the IP of your new server and replace yourdomain.com.au with your domain name. Save file.
Note: If you do not run your PC as an Administrator then you may get an privilages error. To get around this without booting as Admin, simply go to notepads location either in start menu or in your program files, right click and run as administrator.
Copy the content of the host file and save to the above location.

If you do not know the IP address of your new server these details are normally found in your Account Information email or on the left hand side of Cpanel. If you do not have either of these, go to search on your Computer and look for CMD. This will open dos.

Type ping website address (normally the server address they gave you)

Once you have tested your site and it is working update Name Servers.
 

helloworld

Top Contributor
This is generally too advanced for most users just looking for a simple method.
I've done this many times over with my eyes closed now.
Well i think if they're up to moving the site then they are probably up to doing some testing first. Each to there own though
 

Christopher

Top Contributor
All the same good article, I'm doing a site rescue right now, for a client (freelancer) and their client is on plesk, arrgh! The basic principals apply, backup all files, backup databases, There's no cpanel here. I'm not moving the site either But its definitely worth knowing how to backup, and restore, out side of WordPress. I do agree its worth testing, before switching the dns.
 

Oz.

Top Contributor
For migrating a wordpress DB I recommend using the free WP Migrate DB plugin. It has an option to automagically do a find and replace on any file paths (eg: home/old_site/public_html > home/new_site/public_html) and URLs and handling serialised data that you specify.

Then you simple import the resulting zipped sql file with phpmyadmin or whatever you normally use.
 

findtim

Top Contributor
Great article and good to bump it
Ill add mail transfer can be a hassle so best to clean them out before you start . This will slso save a lot of down/upload time

Learning this can help greatly in producing quality moniterised websites that add value to the customer rather then a parked domain
Tim
 

Blue Wren

Top Contributor
Thanks Paul. Good how to.
I did the big host change recently. Fortunately, the new host did it all for me. Couldn't fault their service so far; been great.
 

nt81

Top Contributor
If you're moving from a cPanel host to another cPanel host, forget everything aboce this line and just get your new host to do a cPanel transfer.

No need to complicate things any more than you need to.
 

Community sponsors

Domain Parking Manager

AddMe Reputation Management

Digital Marketing Experts

Catch Expired Domains

Members online

Forum statistics

Threads
10,944
Messages
91,218
Members
2,276
Latest member
zibdigimel
Top