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:
Step 1:You need to Set HTTPS URL into your OpenCart config.php Files:
Ensure that your SSL for the website is enabled >> next you need to edit the two configuration files of your OpenCart and these configuration files are know config.php files which are 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.
Step 1.1: You need to find define('HTTPS_SERVER', 'http://yourdomain.com/') and change it to “https://yourdomain.com/” Here in place of yourdomain.com give your website name.In config.php
// HTTPS
define('HTTPS_SERVER', 'http://yourdomain.com/');
Change it to
// HTTPS
define('HTTPS_SERVER', 'https://yourdomain.com/');
Step 1.2: After the mentioned changes are done >> click on Save Changes
>>>> Next you
Step 2: You need to enable SSL through your OpenCart Admin panel
Step 2.1: Login to your Opencart admin dashboard
Step 2.2: Next go to Setting >> click on Edit Setting
Step 2.3: Find a Server option >> you will find Use SSL- Yes/No. In here you need to click on "Yes" >> then click on Save option.
Step 3: You need to force HTTPS for your domain name
Step 3.1: Create a file name called .htaccess or if .htaccess file present then open in editor mode inside your domain folder
Step 3.2: Add the below code after replacing domain_name with your domain name
RewriteEngine On
RewriteCond %{HTTP_HOST} ^opencart.domain_name [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://opencart.domain_name/$1 [R,L]
Step 3.3: In the same .htaccess file and You need to replace the below
<FilesMatch "(?i)((\.tpl|\.ini|\.log|(?<!robots)\.txt))”>
to this
<FilesMatch "(?i)((\.tpl|\.ini|\.log))”>
Step 3.4: Save the changes which you have made by clicking on save
By following the above steps you can set redirection for your OpencCart site
You check if http is redirecting to https by accessing http://opencart.domain_name.com , it should automatically redirect to https//opencart.domain_name.com.
If you need any assistance, feel free to contact our technical team members as they are available 24/7 via phone call, email, ticket system or call out toll-free no 1800-123-8642. We will be happy to help you.