Leverage browser caching to make your webpages faster. If you can leverage browser caching, you can increase website speed considerably. As Google starts considering site speed as a SEO parameter, webmasters can leverage browser caching to improve site speed and get better search engine rankings. Here, I’ll discuss how you can Leverage Browser Caching WordPress? How it works? And why you should not avoid this?
Follow me on Instagram
What is Browser Caching
A web browser need to retrieve many resources from server (i.e. HTML files, CSS file, text, images etc.) in order to load a website. Web Cache is the technology used in web browsers and software applications to ‘temporally store’ or ‘remember’ visited web page resources on local disc. This temporarily stored data is called ‘cache’.
And when you visit the same website or webpage again. This time web browser downloads only updated content from website and combines it with ‘temporally stored’ data of that website. This is how web cache help to reduce bandwidth usages, server loads etc. Therefore leverage browser caching is important to load your webpages faster.
How to Leverage Browser Caching in WordPress
In order to Leverage Browser Caching WordPress, your web server (where your website is hosted) should allow web browser to store visited webpages data temporally on local disk. This is how you will notice a significant improvement in your website loading speed.
Your next question must be how to enable this? How my web server will allow a browser to leverage website cache. To enable it, you need to set content expiry dates by adding Cache-Control and ETag headers in HTTP headers. Cache-Control states about the caching period of a particular file by web browser and Etag is used to verify changes in cached resources and requested resources. We can set a specific period in months or years to keep cache resources (i.e. HTML, CSS or JS files, images etc.) locally. It is advisable to set expiry dates as per the frequency of changes in resources.
Do you know how to grow your traffic? Here is a tutorial you must read about How to grow your Traffic
Getting rid of ETag
First of all, we need to disable ETag header since we are going to use Expires. ETag
technology is known as slow and problematic – even YSlow complains about it.
Add to .htaccess
: (located at blog’s root location)
Why browser caching?
If you set an expiry date or a maximum age in the HTTP headers for static resources, modern browsers will load previously downloaded static resources like images, css, javascript, pdf, swf etc. from local disks rather than over the network.
So if you configure your web server to set caching headers and apply them to all cacheable static resources, your site will appear to load much faster. Add below to.htaccess
What this does is adding far future expires header (make sure mod_expires is loaded in your apache config if you have problems) to your static content (images, js, css, etc).
Compress Components
Compressing things always ends up making them smaller and load faster, so implementing some form of compression on your components is a must. This optimization step might not work for you if your server does not have either mod_deflate
or mod_gzip
installed as part of Apache.
List of all WordPress Articles: http://www.panayiotisgeorgiou.net/category/wordpress/
Follow me on Twitter
Follow me on Github
Subscribe to my Youtube Channel
[…] WordPress Speed up by leveraging browser caching […]