ECommerce Insights Blog

Stay on top of it all and get ahead with useful articles, how-tos, tips and tricks on e-commerce.

How to move OpenCart website from one domain to another?

how-to-move-opencart-website-from-one-domain-to-another

OpenCart is one of the simplest e-commerce platforms to build an online store. OpenCart offers you an ‘easy-to-work-with’ code-base with which you can get an e-Commerce site online, quickly. If you are looking for a safe way to move OpenCart website from one domain to another, follow the process below.

Here are the steps to migrate / move OpenCart website to a new server.

1. Download ALL the files from old server.
2. Create a backup of Database through PhpMyAdmin
3. Upload files to NEW SERVER
4. Install Database on NEW SERVER through PhpMyAdmin
5. Update the configuration files config.php and admin/config.php to reflect your new domain path.

The file should now open up for editing. Here, you will need to edit a few lines of code. Find the lines:

// HTTP

define('HTTP_SERVER', 'http://yourdomain.com/');

// HTTPS

define('HTTPS_SERVER', 'http://yourdomain.com/');

// DIR

define('DIR_APPLICATION','/
home/sites/YOUR-DOMAIN/public_html/catalog/');
define('DIR_SYSTEM','/home/sites/YOUR-DOMAIN/public_html/system/');
define('DIR_DATABASE','/home/sites/YOUR-DOMAIN/public_html/system/database/');
define('DIR_LANGUAGE','/home/sites/YOUR-DOMAIN/public_html/catalog/language/');
define('DIR_TEMPLATE','/home/sites/YOUR-DOMAIN/public_html/catalog/view/theme/');
define('DIR_CONFIG','/home/sites/YOUR-DOMAIN/public_html/system/config/');
define('DIR_IMAGE','/home/sites/YOUR-DOMAIN/public_html/image/');
define('DIR_CACHE','/home/sites/YOUR-DOMAIN/public_html/system/cache/');
define('DIR_DOWNLOAD','/home/sites/YOUR-DOMAIN/public_html/download/');
define('DIR_LOGS','/home/sites/YOUR-DOMAIN/public_html/system/logs/');

You will need to update these to your correct path. Contact your hosting company for the full path to your public folder.

Next, you need to update the database connection settings. Find the code below:

// DB

define('DB_DRIVER','mysql');
define('DB_HOSTNAME','localhost');
define('DB_USERNAME','your-old-opencart-databse-username');
define('DB_PASSWORD','your-old-opencart-databse-password');
define('DB_DATABASE','your-old-opencart-databse-database');
define('DB_PREFIX','oc_');

You will need to replace these with the new details made in step 3;

DB_HOSTNAME = Your database host (usually localhost).
DB_USERNAME = Your Database username.
DB_PASSWORD = Your Database password
DB_DATABASE = Your database name

Once you have updated these, save the changes & you are done.