Categories

Featured templates

OpenCart. How to move your website from one domain to another

Ray Taylor April 8, 2013
Rating: 5.0/5. From 6 votes.
Please wait...

In this tutorial we will learn how to move your OpenCart website from one domain to another.

OpenCart. How to move your website from one domain to another

  1. Download ALL files from server
  2. Create 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.

1) Download ALL files from server

Connect to the old server and download all files for exact copies.

2) Create backup of Database through PhpMyAdmin

Log into PhpMyAdmin and export the store database, uncompressed to a location on your PC. Also log into the OpenCart store admin area, click tools and create a backup of the database to also save to your PC. The database created through PhpMyAdmin will probably be called localhost.sql

3) Upload files to NEW SERVER

Log onto your new web server via ftp or Hosting Cpanel and upload all store files in binary. Note the config.php file may re-write its permissions which will need to be corrected later.
You may need to correct permissions on other OpenCart files and folders as per the OpenCart installation guide.
Files and folders include; /config.php to 644 (444 on some servers) /admin/config.php to 644 (444 on some servers).

4) Install Database on NEW SERVER through PhpMyAdmin

Log onto your PhpMyAdmin and create a NEW DATABASE, this will be your new database for your OpenCart store, you can use the same name as your old database if possible as this will make things easier.

Assign a user to the database, again if you can use the same user as your old database it will keep things simpler.

Login to your PhpMyAdmin panel, select your New Database, click Import button, browse for exported previously xxxxxxxx.SQL file and click GO button.

5) Change variables in 2 config.php files

In /config.php and admin/config.php you need to change some variables to make the store re-install work. Open these files in notepad, dreamweaver or your preferred html/code editing application.

If you are uploading the copied site to a Directory you need to specify this in the following files:

  • admin/config.php
  • /config.php

Where ‘store’ is the new directory name. Where ‘user’ is your server account address. Where ‘yourdomainname.co.uk’ is the web domain of your new website.

<?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

Where ‘store’ is the new directory name. Where ‘user’ is your server account address. Where ‘yourdomainname.com’ is the web domain of your new website.

<?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_');

Go to your new site to see the result.

Feel free to check the detailed video tutorial below:

OpenCart. How to move your website from one domain to another

OpenCart Themes
This entry was posted in OpenCart Tutorials and tagged another, domain, move, opencart, website. Bookmark the permalink.

Submit a ticket

If you are still unable to find a sufficient tutorial regarding your issue please use the following link to submit a request to our technical support team. We'll provide you with our help and assistance within next 24 hours: Submit a ticket