How to Install OpenCart SSL Certificate?

How to Install OpenCart SSL Certificate?

How to Install OpenCart SSL Certificate? before moving on to the answer to the question, let's explain OpenCart briefly for those who do not know. OpenCart is ecommerce software built on open source PHP. Because it is open source, it allows OpenCart software to be developed with the knowledge of everybody. There are many e-commerce sites that use OpenCart because it is easy to use and develop.

An SSL certificate is an essential feature for e-commerce sites. Because in e-commerce sites, customers enter sensitive data such as credit cards. This data must be transferred safely and protected and for this you need to use SSL certificate. You can learn more about the SSL certificate from our What is an SSL Certificate? Why Use SSL? article.

Purchase SSL Certificate


Firstly you need to purchase an SSL Certificate and this certificate needs to be installed on your server. You may have information about the installation steps from our How to Install an SSL Certificate? article. If you have purchased one of our SSL certificate products, we have free installation support if you request.

OpenCart SSL Settings


After completing the SSL certificate installation, log in to the OpenCart admin panel and activate the Use SSL option under the Security heading under the System->Settings->Store Edit Button->Server tab.

After this setting, we will complete the SSL setup after changing the config.php and admin/config.php files in the main directory where OpenCart software is installed.

Open and Find in config.php file.

define('HTTPS_SERVER', 'http://yoursiteaddress.com/');

Replace with the following.

define('HTTPS_SERVER', 'https://yoursiteaddress.com/');

In the same way, open admin/config.php and find the following code.

define('HTTPS_SERVER', 'http://yoursiteaddress.com/admin/');
define('HTTPS_CATALOG', 'http://yoursiteaddress.com/');

Replace with the following.

define('HTTPS_SERVER', 'https://yoursiteaddress.com/admin/');
define('HTTPS_CATALOG', 'https://yoursiteaddress.com/');

Making All Links SSL


After the above steps, the SSL certificate will be activated on the pages where customer data is entered, such as payment, registration etc. on your e-commerce site. However, if you want to use SSL for all your links on your site, replace all of your addresses beginning with http:// with https:// in the above files.

Https Redirect


As a final step, find the RewriteBase / code in your .htaccess file and add the following code.

RewriteCond %{HTTPS} off
# First rewrite to HTTPS:
# Don't put www. here. If it is already there it will be included, if not
# the subsequent rule will catch it.
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# Now, rewrite any request to the wrong domain to use www.
# [NC] is a case-insensitive match
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

If you are not using your site address with www prefix, make following change in above code.

RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

If %{HTTP_HOST}%{REQUEST_URI} in the above code doesn't work, you can write your site address instead. For example, as follows.

RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule .* https://yoursiteaddress.com%{REQUEST_URI} [L,R=301]

After all these changes, all links on our site will work as https.

You can purchase from our SSL Certificates products for secure e-commerce and benefit from our OpenCart free SSL setup support.


17 people voted before. Would you like to vote?