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 www.example.com 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 (example.com) 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 example.com with your own domain name.
    // HTTP define('HTTP_SERVER', 'https://www.example.com');  // HTTPS define('HTTPS_SERVER', 'https://example.com');
  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 example.com with your own domain name.
  9. // HTTP define('HTTP_SERVER', 'https://www.example.com/admin/'); define('HTTP_CATALOG', 'https://www.example.com/');  // HTTPS define('HTTPS_SERVER', 'https://example.com/admin/'); define('HTTPS_CATALOG', 'https://exmple.com/');
  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!