Here are the steps to migrate Opencart site to a new host/domain.
Step 1: Backup your files
Click here for our guide on how to take a files backup.
Download the files backup at a safe location and proceed to the next step.
Step 2: Backup your database
Click here for our guide on how to take a database backup.
Step 3: Create Database on the New Host
Click here for our guide on how to create a new database
Make sure that you write down the database name, username and its password. You will need them in the step 5.
Step 4: Import the database
Click here for our guide on how to import a database. If your old database is bigger than what you host allows you to upload, try gziping the sql file. phpMyAdmin allows you to import gzip files.
Step 5: Upload the files and update the configuration files
Update config.php and admin/config.php to reflect your new domain path.
define('DB_USERNAME', 'new_database_username'); define('DB_PASSWORD', 'new_database_passowrd'); define('DB_DATABASE', 'new_database_name');
If you are moving your site to a new domain, also update config.php and admin/config.php for the following lines.
define('HTTP_SERVER', 'http://newdomain/'); define('HTTP_IMAGE', 'http://newdomain/image/'); define('HTTP_ADMIN', 'http://newdomain/admin/'); // HTTPS define('HTTPS_SERVER', 'http://newdomain/'); define('HTTPS_IMAGE', 'http://newdomain/image/');
If you are facing issues after the migration, double check the file permissions on the following folders. The permissions should be 0755 for Linux hosting or “Read & Write” for Windows hosting.
image/ image/cache/ cache/ download/ config.php admin/config.php
Also, double check the directory paths in config.php and admin/config.php files. It should be something like
/home/domainname/public_html
If you have recently moved your Opencart installation to a new host or a domain and you are having issues with the admin where it keeps logging you off, make sure you have the php.ini file in your public_html folder.
Additional step: If you are moving to a new domain
Make sure you let the search engines know about the new domain. You can create a 301 redirect from your old domain to the new one. Click here for our guide on how to do a 301 redirect.