Using Free Cloudflare for SSL on OpenCart 1.5

Many people have decided to use the free CloudFlare CDN service with their website. The free option does not allow the use of SSL through CloudFlare. However, there is a workaround that lets you use it with your OpenCart site.

CLoudFlare uses the www subdomain to route through CloudFlare’s servers. This allows your site to be seen via the cached version oncloudflare as opposed to processing directly from InMotion’s servers. However, by setting up the HTTPS configuration to use the NON-www version of your site for SSL ( then the visitor will be routed past the CloudFlare servers directly to the InMotion servers.

This change will need to be made by editing the config.php file for your OpenCart. Below are the step by step instructions.

  1. Log into your cPanel dashboard.
  2. Using the File Manager, navigate to the root folder for your OpenCart.
  3. Open the config.php file for editing.
  4. Ensure the HTTP and HTTPS settings are set up similar to the code listed below. Make sure you replace with your own domain name.
    // HTTP define('HTTP_SERVER', '');  // HTTPS define('HTTPS_SERVER', '');
  5. Save the file by clicking the Save Changes button in the upper right corner.
  6. Staying in the File Manager, navigate to the admin/config.php file.
  7. Open it for editing.
  8. Set the HTTP and HTTPS settings similar to the following, remembering to replace with your own domain name.
  9. // HTTP define('HTTP_SERVER', ''); define('HTTP_CATALOG', '');  // HTTPS define('HTTPS_SERVER', ''); define('HTTPS_CATALOG', '');
  10. Click the Save Changes button to save the file.

Now when your site is visited via non-www, it will route through InMotion Hosting’s servers and when the regular www version is visited, it will use CloudFlare.

Was this article helpful? Join the conversation!