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:

Change:

define('HTTP_IMAGE', 'http://inmotiontesting.com/image/');

To:

define('HTTP_IMAGE', 'http://images.inmotiontesting.com/');

If you are using HTTPS, you’ll want to change the HTTP settings as well:

Change:

define('HTTPS_IMAGE', 'http://opencart.inmotiontesting.com/image/');

To:

define('HTTPS_IMAGE', 'http://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="http://opencart.inmotiontesting.com/index.php?route=common/home">
     <img src="http://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.

Did you find this article helpful?

We value your feedback!

Why was this article not helpful? (Check all that apply)
The article is too difficult or too technical to follow.
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
How did you find this article?
Please tell us how we can improve our Support Center:
Email Address
Optional, but our team may contact you for more information.
Like this Article?

Comments

Post a comment
n/a Points
2014-03-10 8:42 am

Good afternoon,

Here is present the case when is only one store (base store). But how must made in the the case of multi-stores when we have more stores added as sub-domains or addons domains?

I am very interested about subject, so I waiting your answer much early is possible.

Thank you for advice.

Best regards.

Post a Comment

Name:
Email Address:
Comment:
Are you a bot?
Submit

Please note: Your name and comment will be displayed, but we will not show your email address.

Write New!
Do you want to publish a tutorial to our support center?

News / Announcements

SSL Certficate Warnings
Updated 2014-04-14 11:34 am EST
Hits: 2230
Heartbleed 0-day OpenSSL security bug
Updated 2014-04-14 04:43 pm EST
Hits: 5657

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!
Ask a Question

Need more Help?

Search

Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail: support@InMotionHosting.com
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!