Вы находитесь на странице: 1из 5

Let’s assume that you have visited a website before and

website is using leverage browsing cache technique.


Whenever you go to that site again, your browser will have
that information in its cache and the page will load
relatively fast. That’s the reason why loading time is
greater when you first visit a website but if the website is
not using browsing cache technique then It’ll take the
same time to load again because your browser has to load
all the content again. That’s the reason you must use this
technique to improve your website loading time.

How to implement Leverage Browsing

Cache technique Wordpress.


By several ways you can use browser cache technique in your website. I am going to
teach you two ways about how you can speed up your website with Leverage browsing
caching.

1- Using .htaccess File


2- By plugin to your website (best way for the beginners).

Leverage Browsing caching Wordpress


.htaccess

Let me tell you first about what is .htaccess file.


.htaccess file is a configuration file which is readable by
the server. This File can override many server configuration
settings and can be used for authorization, cache control, website
optimization, and URL rewriting. You can find this file in
Filemanager>public_html folder. As you can see in
screenshot below
Just go and edit the .htaccess file and paste this code in it
and remember it must be at the top of .htaccess file.

## 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 ##

# 1 Month for most static assets


<filesMatch ".(css|jpg|jpeg|png|gif|js|ico)$">
Header set Cache-Control "max-age=2592000, public"
</filesMatch>

This code is going to tell your browser about what file to


store and how long to remember it. As you can see we are
using “1 year” & “1 Month” value for different files for
example
“image/jpg = Access 1year”
this value is going to tell the browser to store this file for 1
year and the best thing is you can change the value
depending upon your requirement.
After saving the file you can scan your website with
gtmetrix or google page speed insight tool to see if this
code is working properly on your server. In my case this
code is working properly and leverage browser caching
problem is not there anymore.
Warning:
Be careful with .htacces file it can crash your site if
anything goes wrong so, if you are not comfortable with
httaccess file then I don’t recommend to use this leverage
browser chacing via httaccess technique, but you can ask
your developer to do it for you or you can contact us
anytime for consultation.

Вам также может понравиться