As of today, the OpenCart CMS is one of the most popular platforms for creating online stores. When developing an online store, users may face the need to migrate:
- migrate OpenCart to another hosting;
- migrate OpenCart from a subdomain to a domain;
- migrate OpenCart to another domain.
In most cases, migrating online stores on OpenCart does not cause any serious problems, as long as a certain sequence of actions is followed.
Migrating OpenCart to another hosting
- Copy all website files from the old hosting to your computer (download the website archive via FTP).
- Copy the MySQL database from the old hosting.
- Upload the files to the new hosting.
- Create a MySQL database on the new hosting and import the old database into it.
- In the config.php file and in the admin/config.php file, specify the paths to the root directories (// DIR) and access to the new MySQL database (// DB).
- Redirect the domain to the new hosting (new DNS records for the domain).
Migrating OpenCart from a subdomain to a domain
- Copy all website files from the subdomain to your computer (download the website archive via FTP).
- There is no need to create a new database and import the old one (if the subdomain and the main domain are on the same hosting).
- Upload the files to the hosting in the main directory of the main domain.
- In the config.php file and in the admin/config.php file, specify the paths to the root directories (// DIR) and the website domain (// HTTP and // HTTPS).
Migrating OpenCart to another domain
If the old and new domains for the website are on the same hosting, migrating OpenCart from one domain to another is done similarly to the instructions for “Migrating OpenCart from a subdomain to a domain” (only instead of a subdomain, the old domain of the online store should be understood).
If the old and new domains are located on different hostings, follow the instructions for “Migrating OpenCart to another hosting”, but step #5 will look like this:
– In the config.php file and in the admin/config.php file, specify the paths to the root directories (// DIR), access to the new MySQL database (// DB), and the website domain (// HTTP and // HTTPS).
Problems when migrating OpenCart
1. Depending on the hosting settings, migrating OpenCart may result in a “500 Internal Server Error”. This is often related to the content of the .htaccess file and can be easily fixed by making the following changes in the .htaccess file (located in the root directory of the website):
- change the directive Options +FollowSymLinks to Options +SymLinksIfOwnerMatch
- remove the +ExecCGI parameter
- remove the AddHandler, php_value, php_flag parameters
- delete the -MultiViews directive
2. After migration, the website may not open, or there may be no access to the website admin panel. The most likely causes are:
- the domain is incorrectly specified in the config.php and admin/config.php files (// HTTP and // HTTPS)
- the paths to the root directories are incorrectly specified in the config.php and admin/config.php files (// DIR)
- access to the database is incorrectly specified in the config.php and admin/config.php files (// DB)
SEO Specialist Tip: If the online store is already indexed and you are changing the domain name (migrating from a subdomain to a domain or changing the domain) immediately after migration, you should set up a redirect from the old domain/subdomain to the new one. This can be done using a 301 redirect in the .htaccess file or through hosting services. Also, to speed up the indexing of the site at the new address, specify the new address of the online store in the webmaster accounts of search engines.
