Leverage Browser Caching to Improve Site Speed of WordPress Sites

0
Leverage Browser Caching to Improve Site Speed of WordPress Sites - techinfoBiT
Image Source: Pixabay

Loading speed is one of the most important things for any websites whether it’s a simple blog or business portfolio sites, if your website is not loading fast enough then there is no point of having beautiful design and contents because most of the visitors are not going to wait long to load your web pages. 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. It can be done with the help you caching plugins like W3 Total Cache which can add the necessary codes on behalf of you but you need to make the file editable. Basically, if you are giving the proper permission to the caching plugins like W3 Total Cache or WP Super Cache then it will add the necessary codes on the configuration file on the server called .htaccess.

Related Post: How To Add Thumbnails to WordPress Posts | Enable Featured Image

How to Leverage Browser Caching (Apache)

If you are not using any caching plugins or unable to do it because of any reasons then you can also do it manually. To enable the Leverage Browsing Caching, you need to login to the server using the FileZilla, cPanel or any other FTP or SSH, and then go to the home directory and look for a file named .htaccess.

Now, select the .htaccess and open with any editor so that you can add the codes. Users accessing the file via cPanle’s file manager can right click on the file to get the option to open on the editor. If you are not able to find the file .htaccess then make sure you have enabled the option to show hidden files. In case you are unable to find the file even after enabling the “Show Hidden Files” then you may need to create the file, so right click inside the home directory and create the file with the file name as .htaccess and open in the editor. Once you opened the .htaccess file, you can proceed with adding the following codes; copy the following codes and save 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 ##

If you are adding the above codes then your main static files (images, CSS, PDF’s, JS, etc.) will be cached in order to faster loading times in the future.

The given code will instruct the browser to cache different static resources like images, flash, PDF, JavaScript and icons for some specified period of time. However, you can also increase or decrease the values or time interval depending on your specific requirements.

Now you can check the performance of your website using the Google PageSpeed Tools and YSlow.

Leverage Browser Caching to Improve Site Speed of WordPress Sites - techinfoBiT

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.