OpenCart is one of the worlds leading open source eCommerce platforms for online merchants. It’s a professional and reliable content management system for online stores which appeals to a wide variety of users. OnePoint works with a number or eCommerce platforms and is often asked about the steps of migrating Opencart to a new domain and web host.
Moving an Opencart store to a new domain and web host can be done by following our simple steps below.
Download all files from the server
Take a complete back-up of all website files. If you have CPanel or Plesk, compress your website files and download the zip file. You can also download website files via FTP.
Export a backup of your database
Log in to your existing PHP MyAdmin where your database is located and then choose the Export tab.
Ensure your export format is SQL and select the “custom” option. With the custom settings expanded, select compression to zip and hit the Go button.
Upload the files to the new server
Log onto your new web server via FTP or Hosting CPanel and upload the store files backup zip. Extract the files.
Install and set up a database on the new server
You will need to set up a new database via MySQL Databases. Record the database name, database user and database password.
Once the database is setup, you will needto import the database SQL file we downloaded earlier. Click the Import tab, choose the file and click the Go button.
Update all domains in config files
With our files and database now ready on the new server, the last step is to update the config.php and admin/config.php files which contain the links to your site’s domain.
Replace the MySQL connection values with the new domain name as shown below:
config.php
// HTTP define('HTTP_SERVER', 'http://yourdomainname.com/admin/'); // HTTPS define('HTTPS_SERVER', 'http://yourdomainname.com/admin/'); // DIR define('DIR_APPLICATION', '/home/user/public_html/admin/'); define('DIR_SYSTEM', '/home/user/public_html/system/'); define('DIR_DATABASE', '/home/user/public_html/system/database/'); define('DIR_LANGUAGE', '/home/user/public_html/admin/language/'); define('DIR_TEMPLATE', '/home/user/public_html/admin/view/template/'); define('DIR_CONFIG', '/home/user/public_html/system/config/'); define('DIR_IMAGE', '/home/user/public_html/image/'); define('DIR_CACHE', '/home/user/public_html/system/cache/'); define('DIR_DOWNLOAD', '/home/user/public_html/download/'); define('DIR_LOGS', '/home/user/public_html/system/logs/'); define('DIR_CATALOG', '/home/user/public_html/catalog/'); // DB define('DB_DRIVER', 'mysql'); define('DB_HOSTNAME', 'localhost'); define('DB_USERNAME', 'database_username'); define('DB_PASSWORD', 'newpassword'); define('DB_DATABASE', 'database_name'); define('DB_PREFIX', 'oc_');
admin/config.php
// HTTP define('HTTP_SERVER', 'http://yourdomainname.com/admin/'); define('HTTP_CATALOG', 'http://yourdomainname.com/'); // HTTPS define('HTTPS_SERVER', 'http://yourdomainname.com/admin/'); define('HTTPS_CATALOG', 'http://yourdomainname.com/'); // DIR define('DIR_APPLICATION', '/home/user/public_html/admin/'); define('DIR_SYSTEM', '/home/user/public_html/system/'); define('DIR_DATABASE', '/home/user/public_html/system/database/'); define('DIR_LANGUAGE', '/home/user/public_html/admin/language/'); define('DIR_TEMPLATE', '/home/user/public_html/admin/view/template/'); define('DIR_CONFIG', '/home/user/public_html/system/config/'); define('DIR_IMAGE', '/home/user/public_html/image/'); define('DIR_CACHE', '/home/user/public_html/system/cache/'); define('DIR_DOWNLOAD', '/home/user/public_html/download/'); define('DIR_LOGS', '/home/user/public_html/system/logs/'); define('DIR_CATALOG', '/home/user/public_html/catalog/'); // DB define('DB_DRIVER', 'mysql'); define('DB_HOSTNAME', 'localhost'); define('DB_USERNAME', 'database_username'); define('DB_PASSWORD', 'newpassword'); define('DB_DATABASE', 'database_name'); define('DB_PREFIX', 'oc_');
It is very important that all your paths and links in these files end with a slash, if yours don’t; the links will not resolve properly.
Go to your new site to see the result.