{"id":750,"date":"2020-06-04T14:14:11","date_gmt":"2020-06-04T06:14:11","guid":{"rendered":"https:\/\/www.wesbytes.com\/guide\/?post_type=kb&#038;p=750"},"modified":"2026-01-12T09:47:30","modified_gmt":"2026-01-12T01:47:30","slug":"how-to-force-opencart-to-work-with-https","status":"publish","type":"kb","link":"https:\/\/www.servergigabit.com\/guide\/kb\/how-to-force-opencart-to-work-with-https","title":{"rendered":"How to force Opencart to work with HTTPS"},"content":{"rendered":"<h3>How to force Opencart to work with HTTPS?<\/h3>\n<p><strong>This article will talk about running Opencart application with HTTPS<\/strong><\/p>\n<p>For this case we shall use sample domain : opencart.worldfortesting.com<\/p>\n<p>Webpage without HTTP :<\/p>\n<p><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone\" src=\"https:\/\/s3.amazonaws.com\/cdn.freshdesk.com\/data\/helpdesk\/attachments\/production\/14054247977\/original\/0GX7gE3OTbHOjuUCT767ezl-GH7nelAR3g.png?1569378953\" alt=\"How to force Opencart to work with HTTPS?\" width=\"938\" height=\"323\" \/><\/p>\n<p>After SSL installed. If you tried to access the webpage with HTTPS, you might see the application broken as below :<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/s3.amazonaws.com\/cdn.freshdesk.com\/data\/helpdesk\/attachments\/production\/14054247991\/original\/5CkgYseI3MqBFFOglbgOtRDN8Q-ijnYYwg.png?1569378977\" \/><\/p>\n<p><strong>In order for the Opencart application to work well with HTTPS, some updates have to be done as below :<\/strong><\/p>\n<p>1. Set your HTTPS URL in config.php Files<\/p>\n<p>Before you enable the SSL in your <a href=\"https:\/\/www.opencart.com\/\" rel=\"nofollow noopener\" target=\"_blank\">OpenCart<\/a> admin dashboard, you need to edit the two configuration files of your<\/p>\n<p>OpenCart<\/p>\n<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>\n<p><img decoding=\"async\" src=\"https:\/\/s3.amazonaws.com\/cdn.freshdesk.com\/data\/helpdesk\/attachments\/production\/14054248026\/original\/5OOQzcRheBqc9iZ5_g3Ed8u7biUKNPx6Sw.png?1569379048\" \/><\/p>\n<p>3. Choose the file and click\u00a0<strong>Code Editor\u00a0<\/strong>to edit the config.php file.<\/p>\n<p>You need to locate the following section in both of your files:<\/p>\n<p>\/\/ HTTPS<br \/>\ndefine(\u2018HTTPS_SERVER\u2019, \u2018http:\/\/yourdomain.com\/\u2019);<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/s3.amazonaws.com\/cdn.freshdesk.com\/data\/helpdesk\/attachments\/production\/14054248086\/original\/p1HNabUlOfuEVu2_t7ShPjPghSyuBltdxQ.png?1569379171\" \/><\/p>\n<p><strong>Modify the line to include https instead of http<\/strong>:<\/p>\n<p>\/\/ HTTPS<br \/>\ndefine(\u2018HTTPS_SERVER\u2019, \u2018https:\/\/yourdomain.com\/\u2019);<\/p>\n<p>Sample done as below :<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/s3.amazonaws.com\/cdn.freshdesk.com\/data\/helpdesk\/attachments\/production\/14054248037\/original\/5HvHPofG3XGkWBPqEspmpq7asiu0XDslUg.png?1569379071\" \/><\/p>\n<p>4. Enable SSL via the OpenCart Admin<\/p>\n<p>Now you need to activate the SSL support via the admin dashboard.<\/p>\n<p>Firstly login to your\u00a0 admin dashboard<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/s3.amazonaws.com\/cdn.freshdesk.com\/data\/helpdesk\/attachments\/production\/14054248048\/original\/klp7rUFXsyaAPe8jrGDJ4SX4QdWT2wahMg.png?1569379108\" \/><\/p>\n<p>5. Check the settings part and click \u201cEdit\u201d to edit the store setting.<\/p>\n<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>\n<p><img decoding=\"async\" src=\"https:\/\/s3.amazonaws.com\/cdn.freshdesk.com\/data\/helpdesk\/attachments\/production\/14054248055\/original\/2uBmnIaqeOS8Y8Ofq1Pdl1n-_OlKzZtqpg.png?1569379129\" \/><\/p>\n<p>3. Force HTTPS only for your domain name<\/p>\n<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>\n<p>===========<\/p>\n<p>RewriteEngine On<br \/>\nRewriteCond %{HTTP_HOST} ^opencart.worldfortesting\\.com [NC]<br \/>\nRewriteCond %{SERVER_PORT} 80<br \/>\nRewriteRule ^(.*)$\u00a0https:\/\/opencart.worldfortesting.com\/$1\u00a0[R,L]<\/p>\n<p>===========<\/p>\n<p>b) Open the .htaccess again<\/p>\n<p>Replace this link as below<\/p>\n<p>=========<\/p>\n<p>&lt;FilesMatch \u201c(?i)((\\.tpl|\\.ini|\\.log|(?&lt;!robots)\\.txt))\u201d&gt;<\/p>\n<p>=========<\/p>\n<p>to link as below<\/p>\n<p>=========<\/p>\n<p>&lt;FilesMatch \u201c(?i)((\\.tpl|\\.ini|\\.log))\u201d&gt;<\/p>\n<p>=========<\/p>\n<p>With above, user accessing to http:\/\/opencart.worldfortesting.com (without HTTPS) shall be redirected to https:\/\/opencart.worldfortesting.com which is the page with SSL secured.<\/p>\n<p>&nbsp;<\/p>\n<p><span data-sheets-root=\"1\">Please refer to the following article to know more.<br \/>\nKnowledge Base:<a href=\"https:\/\/www.servergigabit.com\/guide\/kb\/how-to-configure-email-settings-in-opencart-1-5\"> How to configure Email Settings in OpenCart 1.5<\/a><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to force Opencart to work with HTTPS? This article will talk about running Opencart application with HTTPS 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 for the Opencart application to&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"kbtopic":[31],"kbtag":[1607,1606],"class_list":["post-750","kb","type-kb","status-publish","hentry","kbtopic-opencart","kbtag-https","kbtag-opencart"],"_links":{"self":[{"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kb\/750","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kb"}],"about":[{"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/types\/kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/comments?post=750"}],"version-history":[{"count":4,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kb\/750\/revisions"}],"predecessor-version":[{"id":5782,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kb\/750\/revisions\/5782"}],"wp:attachment":[{"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/media?parent=750"}],"wp:term":[{"taxonomy":"kbtopic","embeddable":true,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kbtopic?post=750"},{"taxonomy":"kbtag","embeddable":true,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kbtag?post=750"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}