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.
- Log into your cPanel dashboard.
- Using the File Manager, navigate to the root folder for your OpenCart.
- Open the config.php file for editing.
- 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', 'http://www.example.com'); // HTTPS define('HTTPS_SERVER', 'https://example.com');
- Save the file by clicking the Save Changes button in the upper right corner.
- Staying in the File Manager, navigate to the admin/config.php file.
- Open it for editing.
- Set the HTTP and HTTPS settings similar to the following, remembering to replace example.com with your own domain name.
// HTTP define('HTTP_SERVER', 'http://www.example.com/admin/'); define('HTTP_CATALOG', 'http://www.example.com/'); // HTTPS define('HTTPS_SERVER', 'https://example.com/admin/'); define('HTTPS_CATALOG', 'https://exmple.com/');
- 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.
›Section 2: 348: Creating discounts and specials for your products in OpenCart 1.5