{"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&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
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t

How To Force Opencart to Work with HTTPS<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t\t
\n\t\t\t\t

This article will talk about running Opencart application with HTTPS\u00a0<\/strong><\/p>

For this case we shall use sample domain : opencart.worldfortesting.com<\/p>

Webpage without HTTP :<\/p>

\"\"<\/p>

After SSL installed. If you tried to access the webpage with HTTPS, you might see the application broken as below :<\/p>

\"\"<\/p>

In order for the Opencart application to work well with HTTPS, some updates have to be done as below :<\/strong><\/p>

1. Set your HTTPS URL in config.php Files<\/p>

Before you enable the SSL in your OpenCart admin dashboard, you need to edit the two configuration files of your<\/p>

OpenCart<\/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>

3. Choose the file and click Code Editor\u00a0<\/strong>to edit the config.php file.<\/p>

You need to locate the following section in both of your files:<\/p>

\/\/ HTTPS
define(‘HTTPS_SERVER’, ‘http:\/\/yourdomain.com\/’);<\/p>

Modify the line to include https instead of http<\/strong>:<\/p>

\/\/ HTTPS
define(‘HTTPS_SERVER’, ‘https:\/\/yourdomain.com\/’);<\/p>

Sample done as below :<\/p>

\"\"<\/p>

4. Enable SSL via the OpenCart Admin<\/p>

Now you need to activate the SSL support via the admin dashboard.<\/p>

Firstly login to your\u00a0 admin dashboard<\/p>

\"\"<\/p>

5. Check the settings part and click “Edit” to edit the store setting<\/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>

3. Force HTTPS only for your domain name<\/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>

===========<\/p>

RewriteEngine On
RewriteCond %{HTTP_HOST} ^opencart.worldfortesting\\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$\u00a0https:\/\/opencart.worldfortesting.com\/$1\u00a0[R,L]<\/p>

===========<\/p>

b) Open the .htaccess again<\/p>

Replace this link as below<\/p>

=========<\/p>

<FilesMatch “(?i)((\\.tpl|\\.ini|\\.log|(?<!robots)\\.txt))\u201d><\/p>

=========<\/p>

to link as below<\/p>

=========<\/p>

<FilesMatch “(?i)((\\.tpl|\\.ini|\\.log))\u201d><\/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>

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":"

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 …<\/p>\n

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}]}}