Solved

Imporving Leverage Browser Caching

Posted on 2013-11-25
1
315 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

Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

Question has a verified solution.

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

This article discusses four methods for overlaying images in a container on a web page
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to dynamically set the form action using jQuery.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

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