How to leverage browser caching to speed up your website.

How to leverage browser caching

  1. Change the request headers of your resources to use caching.
  2. Optimize your caching strategy.

Change the request headers of your resources to use caching

For most people, the way to enable caching is to add some code to a file called .htaccess on your web host/server.

This means going to the file manager (or wherever you go to add or upload files) on your webhost.

Browser caching for .htaccess

The code below tells browsers what to cache and how long to “remember” it. It should be added to the top of your .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 ##

Save the .htaccess file and then refresh your webpage.

You can never quit. Winners never quit, and quitters never win

Related Posts

Want a fresh perspective? for your marketing plan?
Newsletter

Subscribe to our newsletter and stay updated to our offers and deals!

We are committed to protecting your privacy

Popular Post

Audit your website by submitting the form below.

Submitting your website may take a moment. Please stay on the page until you receive confirmation with a green check.