This article explains how to optimize your website speed by enabling browser caching for faster website browsing.

 

What is browser caching ?

 

  • Browser caching stores webpage resource files on a local computer when a user visits a webpage.

  • “Leveraging” browser caching is when  you tell the browsers how their resources should be dealt with.

 

 

How to setup leverage browser caching ?

For most people, the way to enable caching is to add some code to a file called .htaccess on your hosting Control Panel.


Step 1 – Going to the file manager on your hosting Control Panel.

 

 

Step 2 – Then editing your .htaccess file.

 

Step 3- Then editing your .htaccess file.

 

 

  • The code below tells browsers what to cache and how long to “remember” it. It should be added to the top of your .htaccess file.

 

## EXPIRES CACHING ##
<IfModule mod_expires.c>
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"
</IfModule>
## EXPIRES CACHING ##

 

 

Once completed you may save your .htaccess file and browser caching will start immediately.

 


 

TIP: Should you require more in depth information regarding this issue we would recommend this article here.