Enable SSL certificate in Open Cart

To turn the SSL certificate on and enable access to the website via https (green padlock), we must perform the following steps:

First, log in to cPanel and go to the File Manager. There, we can find a folder containing the Open Cart system files, and the ‘config.php’ file in the folder.

Then, we edit the line:

// HTTPS
define('HTTPS_SERVER', 'http://clientsdomain.smarthost.eu/');

replacing http:// with https:// and giving the name of our domain (or the directory where our system is located).

Similarly, we proceed with the config.php file in the “admin” directory.

Then, we log in to the management panel of our store and go to “System -> Settings”.

Next, we click on the pencil icon next to the name of our store.

Then, we go to the “Server” tab, find “Use SSL” and check “YES”.

There is also an alternative method but it is not recommended due to complications that may arise after modifying the .htaccess file.

This method can be used by advanced users at their own risk.

If there are RewriteCond and RewriteRule rules in the .htaccess file, try adding the rule:

RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge/[0-9a-zA-Z_-]+$

The rule above is responsible for redirecting to https or to the index.php file. An example configuration of the .htaccess file with additional rules already inserted may look like this:

RewriteCond %{HTTPS} !=on
RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]

Smarthost

Leave a Reply