Caching's Got Me Completely Confused

  • cesarcesar
  • Novice
  • Novice
  • cesarcesar
  • Posts: 23

Post 3+ Months Ago

Cache headers have me completely confused. I have been researching them for a few days now and for some reason I just cant wrap my head around how to do it right (for my needs). I now turn to you o great forum gods.

My quest for knowledge all stared after reading this page (and others), www(dot)askapache(dot)com/htaccess/apache-speed-cache-control.html and the pages in the "Easy Apache Speed Tips Articles" section. While I know this forum is not about Apache, the topic of discussion is headers and I believe that falls here.

My goal is for all objects (images, js, css) in my page to get cached by the browser. Then when the object has been updated on the server and the next time a browser views the object, the new object is downloaded. Yes I know this all sounds basic, but which header to use and how to set it is whats confusing me.

To make my confusion worse, I cant seem to wrap my head around how the headers in the HTML set caching properties for every object in the page. Maybe im just looking too much into it and that's just how the process of caching works.

From the suggestion of this page, www(dot)askapache(dot)com/htaccess/apache-speed-compression.html I have set my .htaccess file as below. Is it wrong? Below that is my current headers from my HTML page. Do I even need those in there if its set in the .htaccess? So confused...

Code: [ Select ]
#####################################################
# CONFIGURE media caching - www(dot)askapache(dot)com/htaccess/apache-speed-compression.html
#
Header unset ETag
FileETag None
<FilesMatch "(?i)^.*\.(ico|flv|jpg|jpeg|png|gif|js|css)$">
Header unset Last-Modified
#Header set Expires "Fri, 21 Dec 2012 00:00:00 GMT"
Header set Cache-Control "max-age=604800, must-revalidate, public, no-transform"
</FilesMatch>
#
#####################################################

#####################################################
# CONFIGURE media caching - www(dot)askapache(dot)com/htaccess/apache-speed-compression.html
#
<IfModule mod_deflate.c>
<FilesMatch "\.(js|css)$">
SetOutputFilter DEFLATE
</FilesMatch>
</IfModule>
#
#####################################################
  1. #####################################################
  2. # CONFIGURE media caching - www(dot)askapache(dot)com/htaccess/apache-speed-compression.html
  3. #
  4. Header unset ETag
  5. FileETag None
  6. <FilesMatch "(?i)^.*\.(ico|flv|jpg|jpeg|png|gif|js|css)$">
  7. Header unset Last-Modified
  8. #Header set Expires "Fri, 21 Dec 2012 00:00:00 GMT"
  9. Header set Cache-Control "max-age=604800, must-revalidate, public, no-transform"
  10. </FilesMatch>
  11. #
  12. #####################################################
  13. #####################################################
  14. # CONFIGURE media caching - www(dot)askapache(dot)com/htaccess/apache-speed-compression.html
  15. #
  16. <IfModule mod_deflate.c>
  17. <FilesMatch "\.(js|css)$">
  18. SetOutputFilter DEFLATE
  19. </FilesMatch>
  20. </IfModule>
  21. #
  22. #####################################################


Code: [ Select ]
<meta http-equiv="expires" content="Fri, 21 Jan 2011 00:00:00 GMT">
<meta http-equiv="Cache-Control" content="public">
  1. <meta http-equiv="expires" content="Fri, 21 Jan 2011 00:00:00 GMT">
  2. <meta http-equiv="Cache-Control" content="public">


So in final i guess my question is, how do i set the most effective headers in my HTML or better my .htaccess file to achieve the fastest page load speed? How do I insure users are always getting the most current version of a file. Thanks for reading this and the time to respond.

Cesar
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

Post Information

  • Total Posts in this topic: 1 post
  • Users browsing this forum: No registered users and 44 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.