How to move a WordPress website to another shared host

Tutorials 0 lượt xem

In the process of managing the operation of a website, it is difficult to avoid the situation of having to switch to another host. There are many reasons for you to do that.

In addition, many hosting companies often promote hosting services when you sign up for a new host. In fact, switching hosts is not too complicated.

So it’s best to do it yourself. In this article, I will show you step by step how to move your WordPress website to another host using cPanel.


move host cpanel 16

Steps to prepare before moving wesbite

Add domain to new host

Adding a new domain to hosting can happen in two ways. First you add a new name to the host as the primary domain. This situation occurs when you register to buy a new host.

The second form is to add the domain name to the new host in the form of an add-on domain. The specific way I mentioned in the article on how to use cPanel for newbies . If you don’t know, you can read it again.

Disable cache and security plugins if present:

To ensure a smooth transition of your website to a new host, you should disable cache plugins such as W3 Total Cache , Super Cache or LiteSpeed ​​Cache . You also disable security plugins such as iThemes Security.  And a plugin to create a form like contact form 7 or ninja form. 

Instructions to move WordPress website to a new host.

The fastest way to move your website to a new host is to use the Duplicator plugin. How to use this plugin you can see here .

In this article, I will use the manual method. This method is of course not as convenient as Duplicator. But for a website that has a relatively large capacity, using the Duplictor plugin to create a copy of the website is often faulty.

As in my case, every time I run Duplicator for a website with a capacity of nearly 1G, it will fail anyway. Because Duplicator when running with a large website will consume all the allowed resources of the shared host package. Leads to the running process will stop suddenly. 

As for how to do it manually, you will basically do three things. First, you copy the source code and database of the website from the old host to the new host. Next, you edit the database connection information to match the database on the new host. Finally, after checking that the website is working ok, you will point the domain to the new host.

The important point here is that I will share how to check the website when running on the new host without having to point the domain to the new host in a hurry. Doing so will limit the impact of the host change. Users won’t even know you’ve moved your website to a new host.

Here are the steps to move your website to a new host:

Step 1: Download the source code of the website at the old host

You access cPanel and scroll down to the files section. Click on File Manage item . This will take you to the file manager screen on the host


move host cpanel 1

Then you move to the folder containing your website. If your website’s domain is the main domain, your website will be in the root directory (public_html). Conversely, if the domain is an add-on domain, your website’s source code will be in a folder with the same name as the website’s domain.

Once inside the folder containing your website source code, click Select All to select the entire file. Next, right-click and select Compress from the contextual menu that appears. Or you can press the Compress button from the toolbar at the top of the screen.


move host cpanel 2

A popup appears asking you to enter the compressed file name. Enter any name and click the Compress Files button.


change host cpanel 3

As soon as the compression is complete, download the .zip file to your computer.


move host cpanel 4

So you have the source code of the website. You will upload the source code to the new host in the next step.

Step 2: Backup the database on the old host

Also in the old host’s cPanel screen, go to the Databases section. Click on the icon of the phpMyAdminh application


switch host cpanel 5

This will redirect you to the phpMyAdmin screen. Here you select your website’s database in the left panel. Next, click on the tab called Export.


change host cpanel 6

On the screen of the Export tab , click the Go button


move host cpanel 7

Now you will download a file with the extension .sql containing the entire database of the website. You will import this file into the database on the new host.

Step 3: Upload the source code to the new host

Now log in to the new host’s cPanel. You move to the files section and click File Manager. On the file management screen of File Manager, you move to the folder containing the website.

If the domain you add to the new host is the main domain, the directory will be the root directory (public_html). If you add the domain as an add-on domain, a folder with the same name as your domain will be created. And you will put the source code of the website you intend to move into it.

As in the example below, I added the domain lookwp.info as an add-on domain. You will then have a folder called lookwp.info. Now I will move into that folder. And click the Upload button.


move host cpanel 8

Next, select the zip file you downloaded above.

When the upload is complete, go back to File Manager and click Reload. You should now see the zip file you just uploaded.

Select this file and click Extract from the right-click context menu or click the Extract button on the toolbar.


move host cpanel 9

As soon as the source code has been extracted, you should delete the zip file to free up less host space.

Step 4: Migrate the database to the new host

First you need to create a database on the new host.

In the new host’s cPanel, go to the Databases section . Click on the MySQL databases application.


move host cpanel 11

Here you create a new database. Then you create a new user and assign that user to the database you just created. If you don’t know how, you can review my cPanel how to use article .

After you have the database you click on phpMyAdmin in cPanel. Here, select the database you just created and click on the Import tab.

Next, you click Choose File . A popup asks you to select a file from your computer. You select the sql file that you downloaded in the above step. Finally, you click the Go button .


move host cpanel 12

The import time depends on the size of your database. If your database capacity is too large, you can ask the technical staff of your new host for help.

Step 5: Update the connection information with the database in the file wp-config

When you copy the source code to the new host, the wp-config file still contains the connection information with the old host. You need to update this information to match the new host. The information you need to change is the database-name, databaser user, and password.

In the FileManager of the new host, select the wp-config. Next click on Code Editor.


switch host cpanel 13

In the Code Editor screen , you edit the information you circled to match your information.


switch host cpanel 14

Step 6: Check the website before pointing the domain name.

Of course, you need to visit the website to know if it has any errors when moving to a new host. To do this, you do not need to point the domain to the new host.

Here’s how:

You move to the location of the hosts file located at C:WindowsSystem32driversetc . Open the hosts file and add the following line to the hosts file:

119.81.140.208              lookwp.info

You change the IP address back to the IP address of the new host. To know the IP address of the new host. You click Advaned DNS zone in cPanel. Then select the domain for which you want to know the IP. Scroll down and you will see the IP address.

Next, you change the domain value to your domain.

Now you can comfortably check if the website after switching to the new host has any errors or not.

Step 7: Point the domain name to the new host.

After making sure the website works OK, you need to point the domain to the new host. Specific ways you can refer to this article of mine.

Epilogue

Above I have guided you step by step how to move your website to a new host. It looks like a lot of steps, but if you do it a few times, you will definitely get used to it and operate quickly.

And also don’t forget to share the article on social networks if you find it useful.

View articles in the series

Next part: How to migrate and backup your website with the Duplicator plugin

Bài viết liên quan