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:
If you are using HTTPS, you’ll want to change the HTTP settings as well:
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.