Leverage Browser Caching To Improve Site Speed Of WordPress Sites

0

The phrase “Leverage Browser Caching” actually means that different items on your site should have different expire times set. This is recommended by Google, and it will improve your overall Google Page Speed Score. If you have installed W3 Total Cache then you cancheck your site’s Page Speed score on your dashboard itself.

How to Leverage Browser Caching

Find your .htaccess file in the root of your domain,

You can access your .htaccess file through cPanel by clicking on the File Manager. When the popup box appears, click on the Web Root option and make sure that the “Show hidden files” option is checked.

Open it by choosing code edit or edit option after right clicking on it or by any text editor (Notepad for instance) and paste the following directives at the top of the file:

## EXPIRES CACHING ##

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

## EXPIRES CACHING ##

By using this code, our main static files (images, CSS, PDF’s, JS, etc.) will be cached in order to faster loading times in the future.

Now save your .htaccess file and view your site through the eyes of PageSpeed and YSlow! – you are now leveraging browser caching for your site!

What This Code Actually Does?

It will instruct the browser to cache different static resources like images, flash,PDF, JavaScript and icons for some specified period of time. You can also increase or decrease the values depending on your specific requirements. By configuring your web server to set caching headers for cacheable static resources, your site will appear to load much faster.

Do you know any other simple tips to improve site loading speed? Kindly share them in comments below.

plz Join techinfoBiT on facebooktwitter,  or subscribe blog-feed.

LEAVE A REPLY

Please enter your comment!
Please enter your name here