{"id":19562,"date":"2021-05-19T20:14:00","date_gmt":"2021-05-19T12:14:00","guid":{"rendered":"https:\/\/www.mondoze.com\/guide\/?post_type=kb&#038;p=19562"},"modified":"2022-10-11T17:42:00","modified_gmt":"2022-10-11T09:42:00","slug":"how-to-force-opencart-to-work-with-https","status":"publish","type":"kb","link":"https:\/\/www.mondoze.com\/guide\/kb\/how-to-force-opencart-to-work-with-https","title":{"rendered":"How to force Opencart to work with HTTPS"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"19562\" class=\"elementor elementor-19562\" data-elementor-settings=\"[]\">\n\t\t\t\t\t\t<div class=\"elementor-inner\">\n\t\t\t\t\t\t\t<div class=\"elementor-section-wrap\">\n\t\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-eac328e elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"eac328e\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-4282d34\" data-id=\"4282d34\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-38006f2 elementor-widget elementor-widget-heading\" data-id=\"38006f2\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">How To Force Opencart to Work with HTTPS<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-104d92d elementor-widget elementor-widget-text-editor\" data-id=\"104d92d\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\t<p><strong>This article will talk about running Opencart application with HTTPS\u00a0<\/strong><\/p><p>For this case we shall use sample domain : opencart.worldfortesting.com<\/p><p>Webpage without HTTP :<\/p><p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-3539\" src=\"https:\/\/www.mondoze.com\/guide\/wp-content\/uploads\/2021\/03\/oc1-300x103.png\" alt=\"\" width=\"300\" height=\"103\" \/><\/p><p>After SSL installed. If you tried to access the webpage with HTTPS, you might see the application broken as below :<\/p><p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-3540\" src=\"https:\/\/www.mondoze.com\/guide\/wp-content\/uploads\/2021\/03\/oc2-300x73.png\" alt=\"\" width=\"300\" height=\"73\" \/><\/p><p><strong>In order for the Opencart application to work well with HTTPS, some updates have to be done as below :<\/strong><\/p><p>1. Set your HTTPS URL in config.php Files<\/p><p>Before you enable the SSL in your OpenCart admin dashboard, you need to edit the two configuration files of your<\/p><p>OpenCart<\/p><p>2. Both files are called config.php and they are located under the root directory of your OpenCart application and under the admin folder.<\/p><p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-3541\" src=\"https:\/\/www.mondoze.com\/guide\/wp-content\/uploads\/2021\/03\/oc3-300x79.png\" alt=\"\" width=\"300\" height=\"79\" \/><\/p><p>3. Choose the file and click <strong>Code Editor\u00a0<\/strong>to edit the config.php file.<\/p><p>You need to locate the following section in both of your files:<\/p><p>\/\/ HTTPS<br \/>define(&#8216;HTTPS_SERVER&#8217;, &#8216;http:\/\/yourdomain.com\/&#8217;);<\/p><p><strong>Modify the line to include https instead of http<\/strong>:<\/p><p>\/\/ HTTPS<br \/>define(&#8216;HTTPS_SERVER&#8217;, &#8216;https:\/\/yourdomain.com\/&#8217;);<\/p><p>Sample done as below :<\/p><p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-3543\" src=\"https:\/\/www.mondoze.com\/guide\/wp-content\/uploads\/2021\/03\/oc4-300x34.png\" alt=\"\" width=\"300\" height=\"34\" \/><\/p><p>4. Enable SSL via the OpenCart Admin<\/p><p>Now you need to activate the SSL support via the admin dashboard.<\/p><p>Firstly login to your\u00a0 admin dashboard<\/p><p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-3546\" src=\"https:\/\/www.mondoze.com\/guide\/wp-content\/uploads\/2021\/03\/oc5-300x87.png\" alt=\"\" width=\"300\" height=\"87\" \/><\/p><p>5. Check the settings part and click &#8220;Edit&#8221; to edit the store setting<\/p><p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-3547\" src=\"https:\/\/www.mondoze.com\/guide\/wp-content\/uploads\/2021\/03\/oc6-258x300.png\" alt=\"\" width=\"258\" height=\"300\" \/><\/p><p>Proceed to the Server settings tab. And you can see Use SSL option there. Click on the Yes radio button and save your settings.<\/p><p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-3548\" src=\"https:\/\/www.mondoze.com\/guide\/wp-content\/uploads\/2021\/03\/oc7-300x289.png\" alt=\"\" width=\"300\" height=\"289\" \/><\/p><p>3. Force HTTPS only for your domain name<\/p><p>a) Create a file name .htaccess in your domain folder, and put in below code (the domain for this case is opencart.worldfortesting.com) :<\/p><p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-3549\" src=\"https:\/\/www.mondoze.com\/guide\/wp-content\/uploads\/2021\/03\/oc8-300x107.png\" alt=\"\" width=\"300\" height=\"107\" \/><\/p><p>===========<\/p><p>RewriteEngine On<br \/>RewriteCond %{HTTP_HOST} ^opencart.worldfortesting\\.com [NC]<br \/>RewriteCond %{SERVER_PORT} 80<br \/>RewriteRule ^(.*)$\u00a0https:\/\/opencart.worldfortesting.com\/$1\u00a0[R,L]<\/p><p>===========<\/p><p>b) Open the .htaccess again<\/p><p>Replace this link as below<\/p><p>=========<\/p><p>&lt;FilesMatch &#8220;(?i)((\\.tpl|\\.ini|\\.log|(?&lt;!robots)\\.txt))\u201d&gt;<\/p><p>=========<\/p><p>to link as below<\/p><p>=========<\/p><p>&lt;FilesMatch &#8220;(?i)((\\.tpl|\\.ini|\\.log))\u201d&gt;<\/p><p>=========<\/p><p>With above, user accessing to\u00a0http:\/\/opencart.worldfortesting.com\u00a0(without HTTPS) shall be redirected to\u00a0https:\/\/opencart.worldfortesting.com\u00a0which is the page with SSL secured. Below is the screenshot :<\/p><p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-3550\" src=\"https:\/\/www.mondoze.com\/guide\/wp-content\/uploads\/2021\/03\/oc9-300x97.png\" alt=\"\" width=\"300\" height=\"97\" \/><\/p><p>Do update us (support team) if you need assistance on the above settings.<\/p>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>How To Force Opencart to Work with HTTPS This article will talk about running Opencart application with HTTPS\u00a0 For this case we shall use sample domain : opencart.worldfortesting.com Webpage without HTTP : After SSL installed. If you tried to access the webpage with HTTPS, you might see the application broken as below : In order &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"https:\/\/www.mondoze.com\/guide\/kb\/how-to-force-opencart-to-work-with-https\"> <span class=\"screen-reader-text\">How to force Opencart to work with HTTPS<\/span> Read More \u00bb<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"site-sidebar-layout":"no-sidebar","site-content-layout":"page-builder","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"disabled","ast-breadcrumbs-content":"","ast-featured-img":"disabled","footer-sml-layout":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"default","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}}},"kbtopic":[93],"kbtag":[110],"mkb_version":[],"_links":{"self":[{"href":"https:\/\/www.mondoze.com\/guide\/wp-json\/wp\/v2\/kb\/19562"}],"collection":[{"href":"https:\/\/www.mondoze.com\/guide\/wp-json\/wp\/v2\/kb"}],"about":[{"href":"https:\/\/www.mondoze.com\/guide\/wp-json\/wp\/v2\/types\/kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.mondoze.com\/guide\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mondoze.com\/guide\/wp-json\/wp\/v2\/comments?post=19562"}],"version-history":[{"count":4,"href":"https:\/\/www.mondoze.com\/guide\/wp-json\/wp\/v2\/kb\/19562\/revisions"}],"predecessor-version":[{"id":19572,"href":"https:\/\/www.mondoze.com\/guide\/wp-json\/wp\/v2\/kb\/19562\/revisions\/19572"}],"wp:attachment":[{"href":"https:\/\/www.mondoze.com\/guide\/wp-json\/wp\/v2\/media?parent=19562"}],"wp:term":[{"taxonomy":"kbtopic","embeddable":true,"href":"https:\/\/www.mondoze.com\/guide\/wp-json\/wp\/v2\/kbtopic?post=19562"},{"taxonomy":"kbtag","embeddable":true,"href":"https:\/\/www.mondoze.com\/guide\/wp-json\/wp\/v2\/kbtag?post=19562"},{"taxonomy":"mkb_version","embeddable":true,"href":"https:\/\/www.mondoze.com\/guide\/wp-json\/wp\/v2\/mkb_version?post=19562"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}