Enabling SSL on the Opencart system is very easy, however, sometimes we tend to forget the basics. Recently, I’ve had a new SSL Certificate installed for one of my existing Opencart websites. I did the basic changes on the config file in the root and admin folders. I changes all the “http” instances to “https”
<?php // HTTP define('HTTP_SERVER', 'https://mydomain.com/admin/'); define('HTTP_CATALOG', 'https://mydomain.com/'); // HTTPS define('HTTPS_SERVER', 'https://mydomain.com/admin/'); define('HTTPS_CATALOG', 'https://mydomain.com/');
and updated my .htaccess file to:
RewriteEngine on RewriteCond %{HTTPS} !=on RewriteRule (.*) https://www.mydomain.com/$1 [R]
But after doing these changes, Opencart won’t let me login to the admin dashboard anymore. To fix this, just go to your /system/config/ folder open the following files:
- admin.php
- catalog.php
- install.php
- default.php
and change the code (around line 4)
$_['site_ssl'] = false;
to
$_['site_ssl'] = true;
That’s it! You should be able to log back in your admin dashboard. 🙂