How To Implement Browser Side Caching

Implementing browser side caching tells your website visitors web browser to cache certain files in its cache for a pre-set period of time rather than fetching them from the server on each visit. This is another simple thing you can implement to increase page load times.

To do this, you just need to open up your .htaccess file (it’ll be in the document root of your website) and add the following code to the top of it:


 ExpiresActive On
 ExpiresByType image/jpg "access 1 year"
 ExpiresByType image/jpeg "access 1 year"
 ExpiresByType image/gif "access 1 year"
 ExpiresByType image/png "access 1 year"
 ExpiresByType text/css "access 1 month"
 ExpiresByType text/html "access 1 month"
 ExpiresByType application/pdf "access 1 month"
 ExpiresByType text/x-javascript "access 1 month"
 ExpiresByType application/x-shockwave-flash "access 1 month"
 ExpiresByType image/x-icon "access 1 year"
 ExpiresDefault "access 1 month"


As you can see from the above code, it tells your visitors web browser to cache image files (.jpg, .jpeg, .gif and .png) for 1 year and CSS and HTML for 1 month. You can change any of these values as you see fit, but these tend to work fine for most sites.

TIP: If you are using the cPanel File Manager to add the code, you will first need to tweak the settings so that you can view hidden files. To do this, open up File Manager and click on the "Settings" link in the top right of the page. Then check the box that says "Show hidden (dot) files".

  • 10 Users Found This Useful
Was this answer helpful?

Related Articles

Add on Domains and Your public_html folder

You need to imagine your webspace, as say, a tree. Your public_html folder is the trunk - inside...

How Can I Find My cPanel Login Details?

To view your cPanel login details over a secure connection please follow the steps below.  1. Log...

How Do I Upgrade my Package?

To find out about upgrading...... 1. Login to your client area at http://d9clients.com2. Click...

I've Run Out of Disc Space/Bandwidth

If you have run out of disc space and bandwith, you are more than likely on one of our old,...

I Cannot Find My cPanel Username & Password

Your cPanel login details are contained within the email that we sent to you when you first...