Solved

Imporving Leverage Browser Caching

Posted on 2013-11-25
1
311 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 83

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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Find out what you should include to make the best professional email signature for your organization.
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.

726 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