How to Set SSL Connection in Opencart Store

In this article, we are talking about how to set or enable SSL certificate in Opencart Store. First of all you should to confirm that SSL is installed for your domain or not. If a SSL certificate is not installed on your domain please contact to your hosting provider for SSL and follow the instruction and steps suggested by the technical team.

SSL in OpenCart Store
SSL in OpenCart Store

To enable SSL in opencart store if it is installed on your domain you have to edit some code snippets .We are discussing in detail.

  • Opencart Store Admin .
  • Opencart directory Config file .
  • Admin directory Config file.
  • Page on which you want SSL , you must have all link with https not http so that it will be completely secure.

Let us see steps to change which are as follows:

OpenCart Store Admin 

  • Just Login to opencart Store Admin .
  • Go to System >> Setting >> Click on edit.
  • Click on Server tab.
  • Check radio button with yes option to Enable SSL.( Use SSL >> Select Yes)

Opencart directory Config file

  • Connect FTP of Opencart Store or Open Cpanel.
  • Go to root directory of Store.
  • Open config.php file with code editor or download it with ftp.
  • Find the code which looks like given below code .You can see code starting with //HTTPS.
// HTTPS
define('HTTPS_SERVER', 'http://www.opencartstore.com/');
define('HTTPS_IMAGE', 'http://www. opencartstore/image/');

 

  • Replace the given below code to point your SSL URL.
// HTTPS
define('HTTPS_SERVER', 'https://www.opencartstore.com/');
define('HTTPS_IMAGE', 'https://www. opencartstore/image/');

 

  • Now Save the file and If you are using FTP then Upload it to root directory.

 

Admin directory Config file.

  • Open the admin folder
  • Open config.php file with code editor.
  • Find the code which looks like given below code .You can see code starting with //HTTPS
//HTTPS
define('HTTPS_SERVER', 'http://www.opencartstore.com/admin/');
define('HTTPS_CATALOG', 'http://www.opencartstore.com/');
define('HTTPS_IMAGE', 'http://www.opencartstore.com/image/');

 

  • Replace with given below code
//HTTPS
define('HTTPS_SERVER', 'https://www.opencartstore.com/admin/');
define('HTTPS_CATALOG', 'https://www.opencartstore.com/');
define('HTTPS_IMAGE', 'https://www.opencartstore.com/image/');

 

  • Save the config file.

 

Now By default Opencart account login,registration and checkout page will load with SSL. If you want SSL on custom page ,then you can follow given below step.

Custom Page on which you want SSL certificate  : You have to confirm that the page on which you want SSL certificate must be with secure link https, all the links on this page must start with https instead of http. You can attempt with given below code snippets.

<?php if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") { 
   $protocol= "https://";
} else { 
    $protocol= "http://";
}  
$baseurl = $protocol.$_SERVER['SERVER_NAME']; ?>

Now you can update your url like this

<link rel="stylesheet" href="<?php echo $baseurl; ?>/catalog/view/theme/defaul/template/css/bootstrap.min.css">

That’s all. Enjoy SSL certificate on your website.

Leave a Reply

Your email address will not be published. Required fields are marked *