Solved

Imporving Leverage Browser Caching

Posted on 2013-11-25
1
304 Views
Last Modified: 2013-11-25
I need to improve my leverage browser caching.  I have this exact code in my htaccess file but it does not seem to be effective.  Plus, I see this code written differently all over the web.  Ie. some have # in front and some don't. Others use different coding, etc...

How exactly should my code look like.  See below.

<IfModule mod_expires.c>
  #ExpiresActive On
  #ExpiresByType image/gif "now plus 9 years"
  #ExpiresByType image/jpg "now plus 9 years"
  #ExpiresByType image/png "now plus 9 years"
  #ExpiresByType image/x-icon "now plus 9 years"
  #ExpiresByType text/html "now plus 9 days"
  #ExpiresByType text/txt "now plus 9 days"
  #ExpiresByType text/css "now plus 20 days"
  #ExpiresByType text/js "now plus 9 years"
  #ExpiresByType image/ico "now plus 30 days"
  #ExpiresByType application/javascript "now plus 2 weeks"
  #ExpiresByType application/x-javascript "now plus 2 weeks"
</IfModule>
0
Comment
Question by:livewirewebsolutions
1 Comment
 
LVL 82

Accepted Solution

by:
Dave Baldwin earned 350 total points
ID: 39675279
The '#' in the first column makes it a 'comment', not a command.  Here's the manual page from Apache:  http://httpd.apache.org/docs/2.2/mod/mod_expires.html

Note that even without the comment tags, those directives have no effect on items already in the browser cache because that info is only passed when the file is delivered from the server.

There is also a sentence in the fourth paragraph on that page that says those directives will not replace any commands that are already present in the response.

And last, those commands do not over-ride what the user has set in their browser.  If they set their cache to expire in 3 days, that's what will happen.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article discusses four methods for overlaying images in a container on a web page
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now