With each update from searchengines like Google and Bing the speed of your website becomes more and more important and recently even Facebook started changing their algorithm so that faster sites will be shown more often than slower site.
Now I think most developers will use tools.pingdom.com to check the speed of a site and what can be improved. And one thing you can score on is “Leverage browser chaching”
But what IS browser caching?
- Browser caching stores webpage resource files on a local computer when a user visits a webpage.
- “Leveraging” browser caching is when a webmaster has instructed browsers how their resources should be dealt with.
What browser caching does is “remember” the resources that the browser has already loaded. When a visitor goes to another page on your website your logo, stylesheets, etc. do not need to be loaded again, because the browser has them saved / rememberd.
How to use browser caching via .htaccess?
If you want to use browser caching via your .htaccess file you can simply add the following code. It’s recommended to add this to the top of your htaccess file.