Cache Controll Headers

Discussion in 'Apache' started by DaStarBuG, Jun 24, 2011.

  1. #1
    Hello

    I want to have the browser cache images, css and js files to prevent overhead.

    I have set my htaccess file to this:

    
    AddDefaultCharset Off
    Header unset Pragma
    FileETag None
    Header unset ETag
    
    #Inhalte nach Dateityp komprimieren
    AddOutputFilter DEFLATE html htm php css js xml txt
    
    ExpiresActive On
    <IfModule mod_expires.c>
    ExpiresByType image/gif A2592000
    ExpiresByType image/png A2592000
    ExpiresByType image/jpg A2592000
    ExpiresByType image/jpeg A2592000
    ExpiresByType image/x-icon A2592000
    ExpiresByType text/plain A172800
    ExpiresByType text/css A2592000
    ExpiresByType text/js A2592000
    ExpiresByType application/x-javascript A2592000
    ExpiresByType application/pdf A2592000
    ExpiresByType application/x-shockwave-flash A2592000
    </IfModule>
    
    <IfModule mod_headers.c>
      <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$">
        Header set Cache-Control "max-age=2592000, public"
        Header unset Last-Modified
      </FilesMatch>
      <FilesMatch "\.(xml|txt)$">
        Header set Cache-Control "max-age=172800, public"
      </FilesMatch>
      <FilesMatch "\.(css)$">
        Header set Cache-Control "max-age=2592000, public"
        Header unset Last-Modified
      </FilesMatch>
      <FilesMatch "\.(js)$">
        Header set Cache-Control "max-age=2592000, public"
        Header unset Last-Modified
      </FilesMatch>
      <FilesMatch "\.(xhtml|html|htm|xml|xsl|php)$">
        Header set Cache-Control "max-age=3600, public, must-revalidate"
      </FilesMatch>
    </IfModule>
    
    Code (markup):
    The modules mod_expires.c and mod_headers.c are installed however it still does not work.
    If I check with chrome images not loaded from my CDN are still checked for last modification (304 Not Modified).

    I am also using a CDN and have set my CDN PullZone (MaxCDN) to use: Override Cache-Control Header 1 Month and Set Default Cache Time 1 Month
    When I check with chrome all get requests from my CDN are answered with 200 OK.
    Does that mean that files from my CDN are not browser cached as well?

    Any help here is really appreciated.

    This is the website: www.AdSenseExperts.com
     
    Last edited: Jun 24, 2011
    DaStarBuG, Jun 24, 2011 IP