All Collections
SSL Certificates
Mixed Content
How to Fix the Mixed Content Error in OpenCart
How to Fix the Mixed Content Error in OpenCart

All about mixed content issues and how to fix them in OpenCart

Ignas Rimkūnas avatar
Written by Ignas Rimkūnas
Updated over a week ago

Mixed content occurs when you attempt to load images or other content using HTTP instead of HTTPS in their links. To fix this, all you need to do is edit the links on your page so that they start with HTTPS instead.


To force HTTPS in your OpenCart website, first, you will need to ensure that both config.php files (the one in your root public_html directory and one in the /admin/config.php directory) have HTTPS URLs leading to your domain:

  1. Open each file using the File Editor, and press Ctrl+H to open the replace tool

  2. Insert http:// into the first field and https:// in the second one

  3. Click on All next to Replace:

The replace tool in the File Editor at Hostinger showing how to replace all

Save the changes and reload your website - it should be working properly with HTTPS 💪


If there is still some leftover mixed content, go to the OpenCart admin dashboard and open Settings Server. In the Security section, set Use SSL to Yes:

The OpenCart

If the mixed content issue persists after completing the previous steps, open your website's .htaccess file using the File Manager (or create it if non-existent) and insert the following line of code:

Header always set Content-Security-Policy: upgrade-insecure-requests

Save the changes and check your website using incognito mode to verify it's working with HTTPS.

NOTE

  • The .htacess method is not recommended if your website uses symlinks

Did this answer your question?