How to Change Website Hosting in cPanel

10 min read

hosting migration

Making the decision to leave your current hosting provider may be a difficult one. One of the reasons that are often encountered is because they don’t know or are confused about how to move without the website experiencing downtime or other problems.

The key is to research the process before starting, plan your move carefully, and get your new host involved in the moving process so that the transition from one hosting to another is smooth and seamless.

Steps to Move Website Hosting on cPanel

The following are the steps if you want to move hosting a cPanel-based website.

Plan Migration Carefully

The first step in the process of moving from one hosting provider to another is to carefully plan the move.

Be careful in choosing a new hosting and think carefully. Do some research. If you have decided to make a change, there may be good reasons for doing so. Make sure you don’t come across the same problem again with a new hosting provider. Cheap hosting alone should not be an excuse. It is the best hosting that must be chosen so that you can focus on your business and not migrate website hosting constantly, wasting time and money.

After choosing a host, take some time to think about the migration process.

The most common hosting environments are Linux servers based on MySQL/MariaDB database servers and the cPanel control panel. In this tutorial, we’ll show you how to move your site between two hosts that offer both of these things. If your steps involve more exotic or advanced features, ensure that there is full compatibility between your website files and databases with your new hosting provider of choice by checking with their support team before buying.

You should also carefully think about how your website is structured. A simple website consists of just a few static HTML, CSS, and JavaScript files. This type of website only takes a few minutes to migrate. However, most websites today are supported by content management systems of some variation. They consist of two main components: website files and databases.

If you are using a WordPress CMS, there is an easier and faster way to use the Duplicator plugin. We will discuss it in our other articles. Stay tuned!

Think about the website design/structure that you should move and re-install on your new hosting account. In most cases, the process will look like this:

  1. Copy website files and databases from your existing hosting account.
  2. Upload website and database files to your new hosting account.
  3. Test your site on a new server.
  4. Point the domain to the new hosting nameserver (DNS).
  5. Wait a few days to make sure the website runs smoothly on the new hosting server.
  6. Close your old hosting account.

Copy Your Site Files and Database

Your goal in copying your website files and databases is to take a snapshot of your site as it is today so that visitors won’t know that something has changed behind the scenes.

One thing to keep in mind while copying your website files is the importance of the directory structure. Whatever the folder structure on your existing hosting account, don’t change any of the data in it. Download website files exactly as they are, and upload them to a new account without modifying them.

If you move existing files or rename files within those folders, you risk breaking internal links, or worse, the entire content management system (CMS).

Copy Website Files

There are several different ways to copy your website files. One common method is to use an FTP client like Filezilla to do the job.

You can use FTP to copy your site files to your computer in 4 steps:

  1. Create a folder on your computer where you will copy your website files.
  2. Connect to your existing hosting account using FTP and locate your website files. In most cases, they will be in the “public_html” folder.
  3. Drag all your website files into the folder you created and wait for the download to finish.
  4. Open the folder and make sure the files are downloaded as desired. If all is well, close the FTP connection.
  5. After all your files have been downloaded, you will be able to check whether the files are complete.

The next step is to copy your website database. However, if your site only consists of static HTML, CSS, and JavaScript files, and is not connected to the database, you can already upload your website files to the new hosting server.

Copy the Website Database

Next, you will want to retrieve the database associated with your site. To do this, you will use the program provided by your current hosting provider. The most common type of database is a MySQL database, and the most common application for working with MySQL databases is phpMyAdmin.

If your site doesn’t have a database, you can skip this step completely and go ahead and upload your website files.

If your site uses a different type of database, such as a PostgreSQL database, you should use an application that is appropriate for that type of database, such as phpPgAdmin in the case of a PostgreSQL database. Previously, we discussed how to import a PostgreSQL database file using phpPgAdmin .

To copy the MySQL database, go to the control panel of your current hosting account and look for the “PhpMyAdmin” menu.

phpMyAdmin

Click on “phpMyAdmin” and you will enter the application which will be used to search for the appropriate database and download a copy.

On the left side of the screen, you will see a list of databases in your account. Select the database for the website you are moving and click on it. Next, select the Export tab at the top of the window and then click the Go button to download all your databases in SQL format.

Find the downloaded SQL file and move it to the same folder as your website files to make it easier to find when you need it.

Setting Up Website and Database on New Hosting Account

To set up your website on a new hosting account, you need to do four things:

  1. Create a new database on the new hosting account.
  2. Upload your database table to the new database.
  3. Modify your site files to reflect the new database name and credentials.
  4. Upload your site files to the server.

New Database Setup

Depending on how your hosting account is configured, you will create a new database using the “phpMyAdmin” or “MySQL Database Wizard” menu.

First look for the wizard in your new cPanel hosting account.

MySQL-Database

In the following screen you will enter a name for the new database. You can use any name you like.

Create-New-Database

On the next screen, create a user and password for the database. To be safe, you can use a Password Generator to create a strong password. Make sure you keep it in a safe place so you can find it quickly when you need it.

At this point, it’s a good idea to make a note of the database name, username, and password. Once you store it safely in a place you can easily find it again. After that click Create User.

On the following screen, select the checkbox ALL PRIVILEGES and click Next Step.

On the next screen you will see a success message telling you that the user you created has privileges in the database. Your database is now set up and ready to import the SQL data you downloaded from the previous host.

Upload Data to New Database

Return to the cPanel interface and select “phpMyAdmin”. You should now be able to find the new database you just created in the sidebar on the left side of your screen.

Select the database you just created and click the Import tab at the top of the window. On the Import page, select Choose File and select the database file.

After finding and selecting the database file, scroll to the bottom of the page and click Go. After a few seconds, you will see a message telling you that the import was successful.

Change Website Files

If your site consists of website files and databases, you will need to modify your website files to connect them to the database you just created.

The files that need to be changed to connect your website and database will vary depending on the software on your site. Here are the files you’ll want to look for if you’re using one of the three most popular content management systems (CMS):

  • WordPress: wp-config.php
  • Joomla: configuration.php
  • Drupal: settings.php

Drupal looks more like WordPress than Joomla, but the order and format is slightly different so pay attention when you enter your database, user, and password data.

Now save the changes you have made and close the file. If you use different software to power your website, you will need to refer to the documentation that applies to your software to find the correct file you want to change.

Upload Website Files

You are now ready to upload your website files. The easiest way to upload files is to use an FTP client. If you’ve never used FTP to connect to your new hosting account you’ll need to first create a new FTP account. Return to the control panel of your new hosting account and look for the “FTP Accounts” menu.

FTP-Accounts

Follow the instructions to create an FTP account, and then use the information provided by your hosting provider to connect your FTP client to your new hosting account.

Next, find the “public_html” folder and drag your site files into it.

Remember, you must maintain the same directory structure when uploading your website files. So if your site files are contained directly in the “public_html” directory on your old hosting account you put them directly into the same directory on your new hosting account. Likewise, if your website files are you are in a sub-directory under “public_html”, follow the layout of that sub-directory in your new hosting account.

Test Your Site Before Launching the Website

Ideally, you would test the connection between your website and your database before going live with your website hosted by your new host. However, doing so is an advanced technique that we can only describe at a high level as the process varies from one content management system and hosting provider. to the next hosting. Contact your new hosting provider if you need help with this step.

If you didn’t test the connection before pointing your domain to your new host’s nameservers, then plan on transitioning from your old host’s nameservers to your new host’s nameservers for when your website experiences low traffic. For many websites, late at night over the weekend is a good time to plan the transition. Study your site’s visitor statistics to determine the best time to make changes with minimal distraction if something goes wrong.

You need to do two things to access your website before it goes live:

  1. Decide how your host will enable temporary URLs and formulate a URL for access to your account.
  2. Adjust the configuration details of your website which may be stored in a configuration file or in a database table, to reflect the temporary URL.
  3. Your host may provide documentation that contains the information you need to formulate a temporary URL. If you can’t find the documentation you need, contact your new hosting’s Support Team for assistance.

In most cases, your temporary URL will look like this:

ip server>/~username/

The first part of the address consists of your shared hosting IP address (please see the email you received) and the second part is your control panel username preceded by the ~ symbol (tilde). You can find your live server address in the Account Information section of your cPanel interface or by contacting your host’s Support Team.

After you have defined a temporary URL and modified your website to work on the temporary URL, visit your site. Your goal is to ensure that the connection between your website files and the database has been successfully established.

Once you have determined that the relationship between your website and database is working properly, go ahead and change the website configuration details again to reflect the permanent domain where the website will be found.

Create New Domain

Before you can show your domain name on your website hosted on your new hosting account, you have to create a domain record on your new hosting account. In your hosting account’s control panel (cPanel) find the “Add-on Domains” menu.

Addon-Domains

When you create an add-on domain, use the URL you want your website to be discoverable. For document root, make sure to use the folder where you uploaded your website files.

Create-an-Addon-Domain

Create Email Address

Before changing your domain name servers you will want to recreate the email addresses that are currently receiving email on your old hosting account. If you don’t set up an email address before pointing your domain at your new hosting account, some incoming email may be lost.

In your hosting control panel, look for the “Email Accounts” menu.

7 Email-Accounts-768x317

From the next screen, go ahead and recreate the email address that received email on your old hosting account.

Update Security Certificate (SSL)

If your site is accessed via https, you will need to install your SSL certificate on your new hosting account to continue using it. In most cases, you will need your new hosting provider to assist you in installing the certificate. Check with your new host about how to install an existing SSL certificate, and note that you may have to pay an additional fee for the hosting company to complete the installation process for you.

Update Your Domain Nameserver

Now that you’ve got your website set up and tested, and your email inbox ready it’s time to point your domain name to your new host’s nameservers. Go to your domain control panel and look for the Update Nameservers (DNS) menu. Your new host’s Nameserver information should be in the welcome email, the format is usually like this:

ns1.hostnameprovider.com

ns2.hostnameprovider.com

After you update your domain nameservers, what happens next is your domain name registrar will start sending updated information to all DNS servers around the world. This process is called propagation (DNS Propagation) and it can take from a few hours to 24 hours for the information to spread to all servers around the world. Until propagation is complete, your website should be accessible on both old and new hosting accounts.

Domain Name Transfer

Your domain name is registered and renewed with a domain name registrar. Your website is hosted by a hosting provider. In many cases, your hosting provider and domain name registrar may be in the same company.

If you find it easier to have a domain name and hosting managed by the same provider, you can easily transfer the domain name registration to your new host. to your account and unlock the domain name for transfer. The complete steps can be seen in the following tutorial on how to transfer a complete domain.

Once you’ve released your domain name for transfer to a new host, visit the Transfer Domains page on your new host.

From this point on, the process will vary depending on who you are hosting. Usually there is an additional fee to process this domain transfer, but you will also get an additional year of renewal for the active period of your domain.

Follow the instructions provided by your host to complete the transfer and then verify that your domain name points to your hosting account correctly.

Cancel Your Old Hosting Account

Once you have completed the process of migrating your website to your new hosting provider, it is a good idea to wait at least 3-5 days before canceling your old hosting account. Do a test using the “Free DNS Checker” tool that is widely available on the Internet to check whether your domain name is pointing to the IP of your new hosting server from around the world.

If it’s still less than 24 hours since you updated your domain to your new host’s nameservers you may need to wait a little longer. If it’s been more than 24 hours, visit your domain name registrar’s website and verify that you’re using your new host’s nameservers correctly.

If everything seems fine, you’ve waited more than 24 hours, and your domain still isn’t pointing to your new host’s nameservers, you’ll need to contact your new host’s Support team to troubleshoot this issue.

Once your domain is properly pointed to your new web hosting account, visitors will visit and interact with your site on this new server. At this point, you can contact your old hosting account provider and officially notify them that you want to close your hosting account.

Note that most hosting accounts are set up to auto-renew at the end of their validity period. So make sure to get confirmation from your old hosting provider that the account has been closed and will not be renewed.

Conclusion

Switching from one hosting provider to another can be a little daunting. However, once you know the steps required to successfully perform this migration, you will certainly feel better equipped to make an informed decision about what steps you should take.

Hopefully this article is useful. Thank You!

Leave a Reply

Your email address will not be published.