Leverage Browser Caching

Leverage Browser Cashing

Leverage Browser Cashing is kind of instruction manual for web browsers.

To understand it we need to understand that how our website works. We need to open our website in a web browser (Firefox, Chrome, Internet Explorer, etc). Now the web browser loads our website as per our website code, it loads our logo, our css files, js file, etc.

The purpose of Leverage Browser Cashing is to instruct web browsers not to reload everything next time our website loads, it help reduce our website loading time. First time it will take time as per our contents but next time our website will open faster.

How we do this?

We do this in a file called .htaccess, we need to place this file in our root directory as well. This file can have a big impact on your website, so if you are not familiar about it, please study or ask someone to do it for you.

I am giving you the code which you need to add into your .htaccess file, simply add following to code .htaccss file and save it. Upload it to your website root directory and you are good to go.

<ifModule mod_gzip.c>

mod_gzip_on Yes

mod_gzip_dechunk Yes

mod_gzip_item_include file .(html?|txt|css|js|php|pl)$

mod_gzip_item_include handler ^cgi-script$

mod_gzip_item_include mime ^text/.*

mod_gzip_item_include mime ^application/x-javascript.*

mod_gzip_item_exclude mime ^image/.*

mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*




<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”



Add Comment

Your email address will not be published. Required fields are marked *