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.


How to Get FREE SSL Certificates for your Websites

Normally, SSL Certificates is used for secure transactions such as internet payment, data transfer and logins activities on a website. The data transfer between a user, and webserver is encrypted.

If you browse through a website that installed SSL certificates, the URL will begin with “https” instead of “http”

For a webmaster who owns an online shop, you probably need SSL Certificates. On top of being secure, it also increases the confidence of a potential buyer to your website. Normally, webshop owner has to pay a couple of dollars per year to obtain signed SSL Certificates.

Recently, Cloudflare introduced “Universal SSL” for all their users. With this, all Cloudflare users get FREE SSL Certificated for their websites, including FREE User. This is indeed a great news for those who are in a tight budget.

There are 3 different type of SSL offered by Cloudflare

  1. Flexible SSL – SSL in only between the visitor and CloudFlare datacentre. Visitor sees HTTPS on your site, but no SSL connection between CloudFlare and your web server.
  2. Full SSL – SSL in between the visitor and CloudFlare datacentre and also in between CloudFlare datacentre and your web server. Visitor sees HTTPS on your site. You’ll need to have your own SSL cert or self-signed cert at the very least.
  3. Full SSL (Strict) – SSL in between the visitor and CloudFlare datacentre and also in between CloudFlare datacentre and your web server. Visitor sees HTTPS on your site. You’ll need to have a valid SSL certificate installed on your web server and must be signed by a certificate authority, have an expiration date in the future, and respond for the request domain name (hostname).

To utilize this FREE service is very simple. After sign up and add your domain in your Cloudflare account, simply click on CloudFlare settings for the domain, browse down until you see “SSL” option. From there you can select Flexible SSL, Full SSL, Full SSL (Strict) or even turn SSL OFF.