How to Enable Browser Caching in WordPress

Enable browser caching in WordPress

If you find that your website is getting slow at loading pages, then it may be time for you to enable browser caching in WordPress.

The procedure to do the same is fairly easy and yes, enabling browser caching in WordPress can actually get your pages to load faster.

According to various studies, most online users spend hardly more than a few seconds browsing a web page and if your page does not load promptly enough, they are not going to stick around and you are bound to lose out on prospective leads and actual customers.

That’s reason enough as to why you may want to enable caching on your website, at the earliest. And since WordPress comes with advanced functionality, it should be fairly easy to do so and you do not even have to be a tech expert.

Just follow the steps listed below and you should be able to boost the performance of your website in no time at all. Just remember to always do a complete backup before you get started.

If you are still not sure about what browser caching is all about, it works like this – a web browser may retrieve information from many sources such as HTML files, CSS, JavaScript and so on to load a particular web page.

Web cache is the technology that is used to store information on frequently visited sites on your local disc. And when you visit such a site, since the prior data, information is stored; your page should load a lot faster.

How to Enable Browser Caching in WordPress

This is why it makes sense to enable browser caching in WordPress at the earliest. You can follow the steps listed below and if you are not sure that you want to do it manually, you can always download and install cache plugin on your website.

1. Leverage browser caching:
In order to leverage browser caching, your web server should allow web browser to store visited web page resources temporarily on the local disk.

Doing so, should enable your pages to load faster when a user visits your web page and in the process, cause your pages to load much faster. In order to enable caching, and to allow the browser to leverage your cache, you will need to set content expiry dates by adding cache control headers and ETag headers in HTTP headers.

You can set the time for the cache to store the required information, and you can optimally set it for a year but no longer than that. You can change the time limit depending on the frequency of changes in resources.

2. Editing your ht access file:
If your WordPress website is stored on an apache server or for that matter, any server, then you would be required to make the following changes to your .htaccess file.

Keep in mind that it is advisable that you do a complete backup before you get started. Just copy and paste the following code in your ht access file and you would have enabled browser caching on your WordPress site.

You need to login to your FTP account, using the credentials that your web host would have provided you with, head over to the root directory of your website, locate the .htaccess file and download the same to your computer.

Open the file in your text editor and copy paste the code posted below, ‘as it is’ and that should do the trick

ExpiresActive On
ExpiresByType text/css “access 1 month”
ExpiresByType text/html “access 1 month”
ExpiresByType image/gif “access 1 year”
ExpiresByType image/png “access 1 year”
ExpiresByType image/jpg “access 1 year”
ExpiresByType image/jpeg “access 1 year”
ExpiresByType image/x-icon “access 1 year”
ExpiresByType application/pdf “access 1 month”
ExpiresByType application/javascript “access 1 month”
ExpiresByType text/x-javascript “access 1 month”
ExpiresByType application/x-shockwave-flash “access 1 month”
ExpiresDefault “access 1 month”
Once you have added the above code, kindly include this in as well – it relates to cache control headers and is required for your caching to work seamlessly.

# TN – BEGIN Cache-Control Headers

Header set Cache-Control “public”

Header set Cache-Control “public”

Header set Cache-Control “private”

Header set Cache-Control “private, must-revalidate”

# TN – END Cache-Control Headers
Now, turn the ET tags of by adding this code,
# TN – BEGIN Turn ETags Off
FileETag None
# TN – END Turn ETags Off

That’s it, now all that’s left is for you to upload the ht access file back to your root directory using the FTP server and reload your website. It should be good to go and your pages should start loading faster.

3. Enabling browser caching with plugins:
While adding the code is more effective, for the not so tech savvy, this option may be preferable. There are a lot of plugins available which enable browser caching in WordPress starting with WP-Plugin.

All you need to do is to download WP Fastest Cache plugin and what’s more, it is free to use. Once you have downloaded the same, you would need to install it on your website.

Access your plugin settings and enable browser caching, and click on save. And by doing so, you would have successfully enabled browser caching on your WordPress website without having to add in any code or upload any file.

You can also use other plugins, check out their info and reviews and select one that seems to be a good fit. With the right plugin, you should be able to get your web pages to load faster, generate more traffic, and reduce HTTP requests which happen to be the case with WP plugin and more.

In short, you should be able to get your website to perform better and this should also have a positive influence on your rankings as well.

These are the steps by which you can enable browser caching on WordPress, and soon you should be able to streamline your website, get more traction online and even help increase the conversion rate.

There are more than a few cache plugins so you may want to shortlist a few, try them out on a trial basis and see if there is a marked improvement on your website.

About Sonal S Sinha

Sonal S SinhaSonal S Sinha is a passionate writer as well as WordPress and WooCommerce rockstar who loves to share insights on various topics through his engaging blog posts. He runs a successful website design and digital marketing company. With 15+ years of experience in WordPress theme development, he strives to inform and inspire readers with his thought-provoking content. He helps thousands of small and medium businesses and startups create a unique online presence. Follow Sonal S Sinha for your regular dose of knowledge and inspiration.

Do check out our free WordPress themes and WordPress themes bundle