How to Move Opencart website from one host to another?



Opencart is one of the Most widely used Ecommerce CMS, It is good fit for the small to medium size of the business requirements. In this post I am trying to describe how to move Opencart website from one host to another host. It is very important to know that open cart has 2 config files (one is on the root where all the files are named as config.php and another one is in the admin folder /admin/config.php), where we have to define the database credentials and the directory path. It is very easy and you can do it just by using the steps given below:

Step 1: Make sure that you have the credentials of the both hosting (FTP, Database access), Now upload all the files on the new host.
Step 2: Setup of the New Database and Import the old database into the New Database which you have setup on this hosting, Put these credentials safe.
Step 3: Now open the config.php file which is on the root, it is just looking like as below:

<?php
// HTTP
define('HTTP_SERVER', 'http://www.ewaexpert.com/');

// HTTPS
define('HTTPS_SERVER', 'http://www.ewaexpert.com/');

// DIR
define('DIR_APPLICATION', '/var/www/ewaexpert/catalog/');
define('DIR_SYSTEM', '/var/www/ewaexpert/system/');
define('DIR_LANGUAGE', '/var/www/ewaexpert/catalog/language/');
define('DIR_TEMPLATE', '/var/www/ewaexpert/catalog/view/theme/');
define('DIR_CONFIG', '/var/www/ewaexpert/system/config/');
define('DIR_IMAGE', '/var/www/ewaexpert/image/');
define('DIR_CACHE', '/var/www/ewaexpert/system/cache/');
define('DIR_DOWNLOAD', '/var/www/ewaexpert/system/download/');
define('DIR_UPLOAD', '/var/www/ewaexpert/system/upload/');
define('DIR_MODIFICATION', '/var/www/ewaexpert/system/modification/');
define('DIR_LOGS', '/var/www/ewaexpert/system/logs/');

// DB
define('DB_DRIVER', 'mysqli');
define('DB_HOSTNAME', 'localhost');
define('DB_USERNAME', 'root');
define('DB_PASSWORD', 'XXXXXXXX123');
define('DB_DATABASE', 'ewaexpert');
define('DB_PORT', '3306');
define('DB_PREFIX', 'oc_');

Step 4: Put these credentials of the New Server, If you have any problem and you did not know the DIR_APPLICATION path, DIR_SYSTEM path just create a info.php with the code below:

<?php 
	phpinfo();
?>

save and upload the file on root of the Opencart directory and access it from the url like http://www.ewaexpert.com/info.php, it will show whole information of the server and from here you can get all Path.

Step 5: Now Update the Config file with the new details save and upload it.
Step 6: Open the Second config file which is under the /admin/ folder it is just looking like as below:

<?php
// HTTP
define('HTTP_SERVER', 'http://www.ewaexpert.com/admin/');
define('HTTP_CATALOG', 'http://www.ewaexpert.com/');

// HTTPS
define('HTTPS_SERVER', 'http://www.ewaexpert.com/admin/');
define('HTTPS_CATALOG', 'http://www.ewaexpert.com/');

// DIR
define('DIR_APPLICATION', '/var/www/ewaexpert/admin/');
define('DIR_SYSTEM', '/var/www/ewaexpert/system/');
define('DIR_LANGUAGE', '/var/www/ewaexpert/admin/language/');
define('DIR_TEMPLATE', '/var/www/ewaexpert/admin/view/template/');
define('DIR_CONFIG', '/var/www/ewaexpert/system/config/');
define('DIR_IMAGE', '/var/www/ewaexpert/image/');
define('DIR_CACHE', '/var/www/ewaexpert/system/cache/');
define('DIR_DOWNLOAD', '/var/www/ewaexpert/system/download/');
define('DIR_UPLOAD', '/var/www/ewaexpert/system/upload/');
define('DIR_LOGS', '/var/www/ewaexpert/system/logs/');
define('DIR_MODIFICATION', '/var/www/ewaexpert/system/modification/');
define('DIR_CATALOG', '/var/www/ewaexpert/catalog/');

// DB
define('DB_DRIVER', 'mysqli');
define('DB_HOSTNAME', 'localhost');
define('DB_USERNAME', 'root');
define('DB_PASSWORD', 'XXXXXXXX123');
define('DB_DATABASE', 'ewaexpert');
define('DB_PORT', '3306');
define('DB_PREFIX', 'oc_');

Step 7: Just put all the new credentials in this file and upload it on the same place /admin/

Now it is done and check your website by accessing the url. Hope it works and your site is moved on the new host.

Please Like the Post on Facebook or Google+.