How to enable SSL connection in OpenCart

Recently, Cloudflare enable FREE SSL Certificates to all the their users. As a long Cloudflare user, I quickly enable it to my OpenCart site. There are 2 levels of SSL in OpenCart. They are

  1. Minimum SSL – Only enable during checkout.
  2. Full SSL – SSL on entire site.

Below are the guides on how to enable both level.

Step 1 – Required for both Minimum SSL and Full SSL

This step involve enabling SSL in the OpenCart Dashboard

Log into the OpenCart Dashboard and browse to

System → Settings → Click Edit Store → Click Server tab → In “Use SSL” Check “YES” in the radio button → Click “Save” Button

Step 2- Only for Minimum SSL

This step involve enabling SSL in the “config.php” file. There are 2 files need to be edited.

1. /config.php

Find this code

// HTTPS
define('HTTPS_SERVER', 'http://www.example.com/');
define('HTTPS_IMAGE', 'http://www.example.com/image/');

Change it to

// HTTPS
define('HTTPS_SERVER', 'https://www.example.com/');
define('HTTPS_IMAGE', 'https://www.example.com/image/');

2. /admin/config.php

Find this code

// HTTPS
define('HTTPS_SERVER', 'http://www.example.com/admin/');
define('HTTPS_CATALOG', 'http://www.example.com/');
define('HTTPS_IMAGE', 'http://www.example.com/image/');

Change it to

// HTTPS
define('HTTPS_SERVER', 'https://www.example.com/admin/');
define('HTTPS_CATALOG', 'https://www.example.com/');
define('HTTPS_IMAGE', 'https://www.example.com/image/');

 

Step 3- Only for Full SSL

This step involve enabling SSL in the “config.php” file. There are 2 files need to be edited.

1. /config.php

Find this code

// HTTP
define('HTTP_SERVER', 'http://www.example.com/');
define('HTTP_IMAGE', 'http://www.example.com/image/');
define('HTTP_ADMIN', 'http://www.example.com/admin/');

// HTTPS
define('HTTPS_SERVER', 'http://www.example.com/');
define('HTTPS_IMAGE', 'http://www.example.com/image/');

Change it to

// HTTP
define('HTTP_SERVER', 'https://www.example.com/');
define('HTTP_IMAGE', 'https://www.example.com/image/');
define('HTTP_ADMIN', 'https://www.example.com/admin/');

// HTTPS
define('HTTPS_SERVER', 'https://www.example.com/');
define('HTTPS_IMAGE', 'https://www.example.com/image/');

2. /admin/config.php

Find this code

// HTTP
define('HTTP_SERVER', 'http://www.example.com/admin/');
define('HTTP_CATALOG', 'http://www.example.com/');
define('HTTP_IMAGE', 'http://www.example.com/image/');

// HTTPS
define('HTTPS_SERVER', 'http://www.example.com/admin/');
define('HTTPS_CATALOG', 'http://www.example.com/');
define('HTTPS_IMAGE', 'http://www.example.com/image/');

Change it to

// HTTP
define('HTTP_SERVER', 'https://www.example.com/admin/');
define('HTTP_CATALOG', 'https://www.example.com/');
define('HTTP_IMAGE', 'https://www.example.com/image/');

// HTTPS
define('HTTPS_SERVER', 'https://www.example.com/admin/');
define('HTTPS_CATALOG', 'https://www.example.com/');
define('HTTPS_IMAGE', 'https://www.example.com/image/');

 

Step 4- Only if you use Cloudflare Flexible SSL

For your domain, select CloudFlare settings domain, browse down until you see “SSL” option. From there select Flexible SSL.

You site should be running on SSL from now on.



2 comments… add one
  • I’ve been fighting SSL with opencart for a long time and your combination of config.php and admin/config.php edits were the secret sauce I needed. Thanks a million.

    Reply
  • hi I did this but it didnt work always show me the red alert when I type https://mywebsite.com
    no green bar

    Reply

Leave a Comment