Using a Subdomain to store your images in OpenCart 1.5 Updated on December 22, 2023 by Carrie Smaha 1 Minutes, 44 Seconds to Read NOTE: This article will only work for Opencart versions prior to 1.5.5.1. It does not work for versions 1.5.5.1 or newer. Google Page Speed recommends using a subdomain to store images that are loaded into your OpenCart store. When a web page tries to load images, scripts, and content they load one at a time. If you have a lot of images, it could dramatically impact your page load speeds. By having the images in a subdomain, they can load at the same time as the site does. First, you’ll need to create a subdomain for the images in cPanel. During the set up of the subdomain you’ll need to set the document root for the subdomain to the current folder where your images are stored. In this example, we set up the subdomain to images.inmotiontesting.com and pointed it to the existing image folder in the root folder of my OpenCart website. Now, you have to edit the config.php file in the root of OpenCart as well as the config.php file in the admin folder: Change: define('HTTP_IMAGE', 'https://inmotiontesting.com/image/'); To: define('HTTP_IMAGE', 'https://images.inmotiontesting.com/'); If you are using HTTPS, you’ll want to change the HTTP settings as well: Change: define('HTTPS_IMAGE', 'https://opencart.inmotiontesting.com/image/'); To: define('HTTPS_IMAGE', 'https://images.inmotiontesting.com/'); If you want to test to make sure your changes have successfully worked, after you have made the changes above load your OpenCart site in a web browser. Then look at the source code to make sure all the image references are pointing to the subdomain. Here’s what our new source code looks like: <div id="logo"> <a href="https://opencart.inmotiontesting.com/index.php?route=common/home"> <img src="https://images.inmotiontesting.com/data/head_logo.gif" title="InMotion Hosting OpenCart Demo" alt="InMotion Hosting OpenCart Demo "/> </a> </div> If you need further assistance please feel free to ask a question on our support center. Share this Article Carrie Smaha Senior Manager Marketing Operations Carrie Smaha is a Senior Marketing Operations leader with over 20 years of experience in digital strategy, web development, and IT project management. She specializes in go-to-market programs and SaaS solutions for WordPress and VPS Hosting, working closely with technical teams and customers to deliver high-performance, scalable platforms. At InMotion Hosting, she drives product marketing initiatives that blend strategic insight with technical depth. More Articles by Carrie Related Articles How to Transfer a Domain Name to InMotion Hosting SPF and DKIM Records: Combating Spam How to Add/Cancel Domain Privacy in AMP Registering a New Domain Name How to Park a Domain in cPanel How to Change Your Domain Nameservers in AMP How To Fix the “DNS Server Not Responding” Error on Windows and Mac Wildcard Subdomains and DNS How to Create a Subdomain in cPanel How to Change Nameservers in Google Domains