Is your website becoming slow with passage of time? Too much plugin installation can make it happen. Leverage browser caching to let your webpages load faster.
If you are able to leverage browser caching, then the speed of your website loading increases considerably.
As Google starts to consider sites loading speed as SEO parameter, website masters can leverage browser caching to enhance site’s speed and get much better search engine rankings.
The slowdown of loading speed of your site occurs due to multiple elements present on your website. All those elements like CSS files, JavaScript, images and etc. result in the same. Below is the kicker of this problem.
Image Credits:Flickr
Getting free of ETag
Firstly, what you need to do is, disable ETag header as we will be using Expires. The ETag technology may also be known as problematic and slow! And even Yslow complains about it.
Now you have to add the following to .htaccess to get rid of ETag
“Header unset Pragma
FileETag None
Header unset ETag”
Why Browser Caching?
If you have established a maximum age or expiry date in the HTTP headers for the static resources, latest browsers will load the formerly downloaded static resources like CSS, pdf, JavaScript, swf and etc. from the local disks instead from the internet.
So if you arrange your server of the web to establish caching headers and then for all cacheable static resources this is applied, you will notice that your site loads much faster now.
To do so, add the following to .htaccess:
“ ## EXPIRES CACHING ##
<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”
</IfModule>
## EXPIRES CACHING ## “
It adds farthest future expires header to the static content of yours like JS, CSS, image etc. if you face problems or difficulties then make sure that mod_expires is laden in your apache configuration.
Compressing Components
Compressing things will always make their size smaller and load, so therefore, implementing compression on your components should be done. Now this enhancing may not work for you if your server does not have any of these i.e. a mod_gzip or mod_deflate mounted as a part of Apache.
For mod_gzip
<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>
For mod_deflate
<FilesMatch “\\.(js|css|html|htm|php|xml)$”>
SetOutputFilter DEFLATE
</FilesMatch>
I’m sure that if you follow the above instructions well, you will surely notice a great difference in your WordPress site page speed. It will eventually increase you page speed score and search engine ranking.
It may not be a very big improvement, nut never the less it is an improvement right? As game calls itself “every bit counts”.
Dont forget to share this awesome article in social media. I will be pleased if you share this now ! Join BloggersIdeas on Facebook, Google+ & Twitter for more updates !
I am getting 96 score in google speed test but it is showing to cache adsense ads does it have any alternative for same?
Hi Jitendra,
The actionable tips pointed out in this post are “technical” but they seem to offer solutions to a common problem most webmasters experience – which is slow website.
Leveraging browser caching by adding ## EXPIRES CACHING ## to the .htaccess file is revealing!