How to redirect from HTTP to HTTPS in OpenCart?


OpenCart is an online store management system. OpenCart is a PHP based eCommerce solution. So using OpenCart is one of the best options if you having an ecommerce website or online store. With OpenCart it offers a complete solution for your website with import features which is essential for an ecommerce store. So today if you using an OpenCart solution for your website and now if you are looking for information on how to redirect from HTTP to HTTPS in OpenCart? Then here is the complete information on it.


But before redirect from HTTP to HTTPS you need to buy an SSL certificate for your website.


Follow the below steps to redirect from HTTP to HTTPS in OpenCart:


>>>> First you need to set your HTTPS URL into your OpenCart config.php Files


---->>> The very first thing that you need to do is to edit the two configuration files of your OpenCart. You will find this config.php files under the root directory of your OpenCart application and also under the admin folder.


---->>> Next in here you need to select the file and then you need to click on Code Editor to edit the config.php file.



---->>> Up next you need to  find

// HTTPS

define('HTTPS_SERVER', 'http://yourdomain.com/');   and change it to


// HTTPS

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


---->>> Once done click on Save Changes








>>>> Next you need to enable SSL through your OpenCart Admin panel


---->>> First login to your Opencart admin dashboard


---->>> Next go to Setting and click on Edit Setting



---->>> Up next you will find a Server option and in there you will find Use SSL- Yes/No. In here you need to click on "Yes". And then click on Save option.



>>>> Next you need to force HTTPS for your domain name


---->>> In here you need to create a file name called .htaccess inside your domain folder and use the below code-


RewriteEngine On

RewriteCond %{HTTP_HOST} ^opencart.worldfortesting\.com [NC]

RewriteCond %{SERVER_PORT} 80

RewriteRule ^(.*)$ https://opencart.worldfortesting.com/$1 [R,L]



---->>> Next you need to go to .htaccess and in there you need to replace the below link


<FilesMatch "(?i)((\.tpl|\.ini|\.log|(?<!robots)\.txt))”>  to link this


<FilesMatch "(?i)((\.tpl|\.ini|\.log))”>


Now your HTTP will be redirected to HTTPS.


Note: Still if you facing some troubles regarding redirection you can contact our support team.