1. Home
  2. Error Message
  3. Cpanel
  4. Migrate Website from Apache to cPanel

Migrate Website from Apache to cPanel


Provide a guideline on how to migrate a website into a cPanel server.




Step 1: Create a New cPanel Account

Access the cPanel server’s WHM portal and login with the credentials

Then, select List Accounts > Create a New Account.

Enter the Domain Information.

Next, select Unlimited_Resources as the package and leave the rest as default.

Step 2: Migrate Web Files

Access the current Apache web server using PuTTY and enter the following command to begin the migration process.

rsync -e 'ssh -p 2211' -avzh /var/www/an/* [email protected]<ip_address>:/home/<server_name>/public_html/

Please enter the destination IP that is communicable via port 2211 (perform telnet to verify this).

Step 3: Prepare Database

Go to the newly-created CPanel account, select MySQL Databases located under DATABASES.

Then, create a new database.

Step 4: Migrate Database

On the existing DB server, backup the database via the following command.

mysqldump -u root -p database_name > database_name.sql

Migrate the newly-created backup file via the following command.

scp -P 2211 [email protected]<ip_address>:/root/ database_name.sql

Return to the remote/cPanel server and enter mysql service using the following command.


Then, enter the command below. Note that you have to use the database that you have created in Step 3.

use database_name;
source database_name.sql;

Step 5: Configure .htaccess

Modify the .htaccess file and put in the following content:

# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress

Step 6: Add Database User

Go to the newly-created CPanel account, select MySQL Databases located under DATABASES.

Then, under Add New User, select Create User.

Finally, ensure that the user has full privileges.

Updated on February 2, 2021

Was this article helpful?

Related Articles

Need Help?
Submit a ticket to us and let our professional team assists you

Support Billing Sales