How to Get Free SSL for OpenCart
OpenCart uses https when the certificate exists on the server and its own URL settings point to it. The details differ by version, so read the right section for yours. Check your version in the admin footer before starting.
Step 1: Certificate from your host
Issue a free certificate in your panel for the root and www names. See free SSL on shared hosting if you are not sure where. Confirm it with the SSL checker.
Step 2: Back up
Copy both config.php files and export the database. You will edit the config files directly.
Free SSL for OpenCart, step 3: the two config files
OpenCart has one config file for the storefront and another in the admin folder. In versions that use these constants, change the https values, and the http ones too if you want the site to always use https:
define('HTTP_SERVER', 'https://example.com/');
define('HTTPS_SERVER', 'https://example.com/');
The admin file has matching lines, including the catalog address:
define('HTTP_SERVER', 'https://example.com/admin/');
define('HTTP_CATALOG', 'https://example.com/');
define('HTTPS_SERVER', 'https://example.com/admin/');
define('HTTPS_CATALOG', 'https://example.com/');
Names and structure vary across OpenCart releases, and 4.x changed how these settings work. Compare with the lines already in your file rather than pasting blindly.
Step 4: Check the setting in the admin
Older versions have a Use SSL option under System → Settings → Edit store → Server. If you see it, enable it. If you do not, your version works from the config files instead.
| Version family | Where https is set | Notes |
|---|---|---|
| 2.x and 3.x | Both config.php files, plus Use SSL where shown | Edit carefully, keep a copy |
| 4.x | Config files and store settings | Check current docs for your build |
Step 5: Redirect all traffic
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
Add it to the .htaccess in the web root. OpenCart ships with an htaccess template, usually named .htaccess.txt, that you rename.
Step 6: Fix insecure content
- Product and category descriptions with http images.
- Banner and slideshow modules using http image paths.
- Theme files that hard-code links.
- Extensions that load outside scripts.
The method in the mixed content guide applies to any PHP store: use the Console to find the URL, then fix it at its source or by a careful database replace.
Step 7: Clear caches
Clear the theme and system cache from the admin dashboard, delete cached files in the storage cache folder if your version uses one, and clear any CDN cache. Reload with a private window.
Free SSL for OpenCart, step 8: test the store
- Open the home page, a category and a product with the Console open.
- Add to cart and go through checkout.
- Check that the payment module loads over https.
- Open the admin and make sure it stays on https.
If you meet loops behind a proxy, read the reverse proxy SSL guide. Later, review headers with the security headers guide.
Modules and payment extensions
Extensions can store their own URLs. Open each payment and shipping module and look for callback or return addresses. Update them to https. Some modules also load scripts from outside hosts, and old ones may use http. Update the extension or ask the author for a version that supports https.
If the site breaks after editing
A blank page or a redirect loop after editing the config files means one of the addresses is wrong. Restore your backup copy of the file, then repeat the change one line at a time. A missing trailing slash is the most common slip. Check the web server error log for the exact failure.
Related reading: free SSL for WooCommerce, free SSL for Drupal and fixing mixed content warnings.
Frequently Asked Questions
Can I leave the HTTP constants as they are?
You can, but the HTTP value will then generate http links. Setting both to https avoids mixed content.
Do I have to edit both config files?
Yes. The storefront and the admin each read their own file, and a mismatch causes odd redirects.
Will old links to my product pages still work?
Yes. The redirect sends each http address to the same path over https with a 301, so old links and search results keep working.
Why does my OpenCart store still load http images?
The image URLs are stored with the old scheme, or the theme builds them from a hardcoded http base. Clear the theme cache and check the config files again before editing the database.
✅ Post-Installation Verification & SEO Checklist
After applying the steps above, run through this 5-point checklist to prevent browser warnings and protect your Google SEO rankings:
- Verify full CA chain trust and TLS 1.3 support using our Live SSL Checker.
- Scan for Mixed Content HTTP links and check HSTS/CSP headers on Security Headers Checker.
- Enforce a permanent 301 HTTP-to-HTTPS redirect with our HTTPS Redirect Generator.
- Confirm both root and
wwwversions resolve cleanly to one canonical HTTPS URL. - Verify your HTTPS property and
sitemap.xmlinside Google Search Console and Bing Webmaster Tools.