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
Solved

Imporving Leverage Browser Caching

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
document.write() deleting all existing HTML 5 49
Read a remote csv file from a https URL 8 44
Accessing specific element - DOM PHP HTML 8 34
PHP Mail error 3 26
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

792 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