Jump Links

7 steps to fix SSL when it fails on Opencart

Back Posted on 23 Mar 2017

Opencart is widely reported to have a number of bugs relating to configuring it to run on a secure SSL connection.

Having experienced this recently I found plenty of others had issues running Opencart in SSL mode including

Fixes suggested often involve editing core files. This is bad practice as changes to the core will be overwritten during future updates. Instead use VQmod or OCmod to extend or update the core witout editing the original files.


Opencart user andreiwd kindly pulled the fixes required to force Opencart to run securely into VQmod.

Installation + configuration

The VQmod file takes care of the bugs in Opencart so all you need to do is configure opencart

  1. backup
  2. install an ssl certificate on your server
  3. update the server urls in Opencart


  4. enable SSL System > Settings, Edit your store, on the Server tab under Security select Yes for Use SSL
  5. apply force https for opencart with VQmod
  6. clear the cache at /system/storage/cache (a necessary step in my case as the navigation menu is written to file and wouldn't pick up url changes automatically)
  7. add redirect rules to force SSL in your web server config file (.htaccess for Apache, web.config for IIS)
  8. update any hard coded URLs using http in the database (example sql below)

Updating hard coded URLs

If your Opencart database includes URLs hard coded to http:// you should update them to https://.

Doing this manually by editing pages and products through the admin panel would be painfully slow and error prone. Thankfully there are better options

Updating the database directly

You can update your database directly through phpMyAdmin, Heidi or any similar tool. The examples below include some default Opencart tables and a few others relating to specific extensions.

Depending on your setup and extensions you will need to adjust the table names and search/replace strings appropriately.

UPDATE oc_menu SET link = replace(link,'http://www.domain.co.uk','https://www.domain.co.uk');
UPDATE oc_redirects SET to_url = replace(to_url,'http://www.domain.co.uk','https://www.domain.co.uk');
UPDATE oc_information_description SET description = replace(description,'http://www.domain.co.uk','https://www.domain.co.uk');
UPDATE oc_blog_article_description SET description = replace(description,'http://www.domain.co.uk','https://www.domain.co.uk');
UPDATE oc_product_description SET description = replace(description,'http://www.domain.co.uk','https://www.domain.co.uk');
UPDATE oc_product_tab_content SET content = replace(content,'http://www.domain.co.uk','https://www.domain.co.uk');