• Hello,

    From gmetrix i am getting the following problem :
    Add expires headers and it’s giving me the following links :

    There are 7 static components without a far-future expiration date.

    https://fonts.googleapis.com/css?family=Lato%3A300%2C400%2C700%2C300italic&ver=4.5.2
    https://fonts.googleapis.com/css?family=Open+Sans%3A300italic%2C400italic%2C600italic%2C300%2C400%2C600&subset=latin%2Clatin-ext&ver=4.5.2
    https://fonts.googleapis.com/css?family=Lato
    https://fonts.googleapis.com/css?family=Lato%3A900
    https://fonts.googleapis.com/css?family=Abril+Fatface%3Aregular&ver=4.5.2
    https://fonts.googleapis.com/css?family=Bitter%3Aregular%2Citalic%2C700&ver=4.5.2
    https://fonts.googleapis.com/css?family=Dancing+Script

    I have already added headers but the problem still persists, any help on how to write the headers for these specific problems would be highly appreciated. Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello,

    put the following block of code in your .htaccess file,

    # BEGIN Expire headers
    <ifModule mod_expires.c>
    ExpiresActive On
    ExpiresDefault “access plus 5 seconds”
    ExpiresByType image/x-icon “access plus 2592000 seconds”
    ExpiresByType image/jpeg “access plus 2592000 seconds”
    ExpiresByType image/png “access plus 2592000 seconds”
    ExpiresByType image/gif “access plus 2592000 seconds”
    ExpiresByType application/x-shockwave-flash “access plus 2592000 seconds”
    ExpiresByType text/css “access plus 604800 seconds”
    ExpiresByType text/javascript “access plus 648000 seconds”
    ExpiresByType application/javascript “access plus 648000 seconds”
    ExpiresByType application/x-javascript “access plus 648000 seconds”
    ExpiresByType text/html “access plus 600 seconds”
    ExpiresByType application/xhtml+xml “access plus 600 seconds”
    </ifModule>
    # END Expire headers

    and try again

    Thread Starter sporbillis

    (@sporbillis)

    Let me show you my .htaccess file just in case i break something! I am using JCH plugin to do that but still gmetrix shows those results. Have a look, let me know if i can do something to improve it! :

    # BEGIN rlrssslReallySimpleSSL rsssl_version[2.3.6]
    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{HTTP:X-Forwarded-Proto} !https
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
    </IfModule>
    # END rlrssslReallySimpleSSL
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress
    
    ## BEGIN EXPIRES CACHING - JCH OPTIMIZE ##
    <IfModule mod_expires.c>
      ExpiresActive on
    
    # Perhaps better to whitelist expires rules? Perhaps.
      ExpiresDefault "access plus 1 month"
    
    # cache.appcache needs re-requests in FF 3.6 (thanks Remy ~Introducing HTML5)
      ExpiresByType text/cache-manifest "access plus 0 seconds"
    
    # Your document html
      ExpiresByType text/html "access plus 0 seconds"
    
    # Data
      ExpiresByType text/xml "access plus 0 seconds"
      ExpiresByType application/xml "access plus 0 seconds"
      ExpiresByType application/json "access plus 0 seconds"
    
    # Feed
      ExpiresByType application/rss+xml "access plus 1 hour"
      ExpiresByType application/atom+xml "access plus 1 hour"
    
    # Favicon (cannot be renamed)
      ExpiresByType image/x-icon "access plus 1 week"
    
    # Media: images, video, audio
      ExpiresByType image/gif "access plus 1 month"
      ExpiresByType image/png "access plus 1 month"
      ExpiresByType image/jpg "access plus 1 month"
      ExpiresByType image/jpeg "access plus 1 month"
      ExpiresByType video/ogg "access plus 1 month"
      ExpiresByType audio/ogg "access plus 1 month"
      ExpiresByType video/mp4 "access plus 1 month"
      ExpiresByType video/webm "access plus 1 month"
    
    # HTC files (css3pie)
      ExpiresByType text/x-component "access plus 1 month"
    
    # Webfonts
      ExpiresByType application/x-font-ttf "access plus 1 month"
      ExpiresByType font/opentype "access plus 1 month"
      ExpiresByType application/x-font-woff "access plus 1 month"
      ExpiresByType image/svg+xml "access plus 1 month"
      ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
    
    # CSS and JavaScript
      ExpiresByType text/css "access plus 1 year"
      ExpiresByType text/javascript "access plus 1 year"
      ExpiresByType application/javascript "access plus 1 year"
    
      <IfModule mod_headers.c>
        Header append Cache-Control "public"
      </IfModule>
    
    </IfModule>
    ## END EXPIRES CACHING - JCH OPTIMIZE ##
    # compress text, html, javascript, css, xml:
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/xml
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE application/xhtml+xml
    AddOutputFilterByType DEFLATE application/rss+xml
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/x-javascript
    AddType x-font/otf .otf
    AddType x-font/ttf .ttf
    AddType x-font/eot .eot
    AddType x-font/woff .woff
    AddType image/x-icon .ico
    AddType image/png .png
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Add expires headers’ is closed to new replies.