[Resolved] Exploiting the browser caching

Home Forums Support [Resolved] Exploiting the browser caching

Home Forums Support Exploiting the browser caching

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #110605
    Philippe

    Hello Tom,

    Hope you’re doing well 🙂

    Have you a solution for exploiting the browser caching and get a better score on :

    https://developers.google.com/speed/pagespeed/insights/

    Best regards.

    #110718
    Tom
    Lead Developer
    Lead Developer

    I like this plugin: https://wordpress.org/plugins/autoptimize/

    It should help with your pagespeed quite a bit 🙂

    #110783
    Philippe

    This is a very nice plugin but it does not define a timeout cache images, if by chance you have another idea?

    #110839
    Tom
    Lead Developer
    Lead Developer

    You may have to go with something like W3 Total Cache to get that kind of flexibility.

    #110878
    Philippe

    I already use WP Fastest Cache which is the best cache plugin of those I tested.

    I have I modified the file “.htaccess” by adding (from http://www.deepintheweb.com/optimiser-un-fichier-htaccess/) :

    # BEGIN Cache-Control Headers
    <ifmodule mod_headers.c>
     <filesmatch "\\.(ico|jpe?g|png|gif|swf|gz|ttf)$">
     Header set Cache-Control "max-age=2592000, public"
     </filesmatch>
     <filesmatch "\\.(css)$">
     Header set Cache-Control "max-age=2592000, public"
     </filesmatch>
     <filesmatch "\\.(js)$">
     Header set Cache-Control "max-age=2592000, private"
     </filesmatch>
    <filesmatch "\\.(html|htm)$">
    Header set Cache-Control "max-age=7200, public"
    </filesmatch>
    # Disable caching for scripts and other dynamic files
    <filesmatch "\.(pl|php|cgi|spl|scgi|fcgi)$">
    Header unset Cache-Control
    </filesmatch>
    </ifmodule>
    # END Cache-Control Headers
    
    RewriteEngine on
    #Check to see if browser can accept gzip files. If so and we have it – serve it!
    ReWriteCond %{HTTP:accept-encoding} gzip
    RewriteCond %{HTTP_USER_AGENT} !Safari
    #make sure there’s no trailing .gz on the url
    ReWriteCond %{REQUEST_FILENAME} !^.+.gz$
    #check to see if a .gz version of the file exists.
    RewriteCond %{REQUEST_FILENAME}.gz -f
    #All conditions met so add .gz to URL filename (invisibly)
    RewriteRule ^(.+) $1.gz [QSA,L]
    <ifmodule mod_gzip.c>
    mod_gzip_on Yes
    mod_gzip_dechunk Yes
    mod_gzip_keep_workfiles No
    mod_gzip_can_negotiate Yes
    mod_gzip_add_header_count Yes
    mod_gzip_send_vary Yes
    mod_gzip_command_version ‘/mod_gzip_status’
    mod_gzip_min_http 1000
    mod_gzip_minimum_file_size 300
    mod_gzip_maximum_file_size 512000
    mod_gzip_maximum_inmem_size 60000
    mod_gzip_handle_methods GET POST
    mod_gzip_temp_dir /tmp
    mod_gzip_item_include file .html$
    mod_gzip_item_include file .php$
    mod_gzip_item_include file .pl$
    mod_gzip_item_include file .rb$
    mod_gzip_item_include file .py$
    mod_gzip_item_include file .cgi$
    mod_gzip_item_include file .css$
    mod_gzip_item_include file .js$
    mod_gzip_item_include mime ^application/javascript$
    mod_gzip_item_include mime ^application/x-javascript$
    mod_gzip_item_include mime ^text/.*
    mod_gzip_item_include mime ^httpd/unix-directory$
    mod_gzip_item_include handler ^cgi-script$
    mod_gzip_item_include handler ^server-status$
    mod_gzip_item_include handler ^server-info$
    mod_gzip_item_include handler ^application/x-httpd-php
    mod_gzip_item_exclude mime ^image/.*
    </ifmodule>
    
    # BEGIN Expire headers
    <ifmodule mod_expires.c>
     ExpiresActive On
     ExpiresDefault "access plus 7200 seconds"
     ExpiresByType image/jpg "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"
     AddType image/x-icon .ico
     ExpiresByType image/ico "access plus 2592000 seconds"
     ExpiresByType image/icon "access plus 2592000 seconds"
     ExpiresByType image/x-icon "access plus 2592000 seconds"
     ExpiresByType text/css "access plus 2592000 seconds"
     ExpiresByType text/javascript "access plus 2592000 seconds"
     ExpiresByType text/html "access plus 7200 seconds"
     ExpiresByType application/xhtml+xml "access plus 7200 seconds"
     ExpiresByType application/javascript A259200
     ExpiresByType application/x-javascript "access plus 2592000 seconds"
     ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
    </ifmodule>
    # END Expire headers

    But Google PageSpeed always tells me that it is no time limit specified for my images :

    Exploitez la mise en cache du navigateur pour les ressources suivantes pouvant être mises en cache :
    http://www.maggeek.com/…332e231a03706ea2c500/1432802522index.css (délai d'expiration non spécifié)
    http://www.maggeek.com/…3a06813c432386a0bf82b/1432802522index.js (délai d'expiration non spécifié)
    http://www.maggeek.com/…89ffed6c16366921d5c6/1432802521index.css (délai d'expiration non spécifié)
    http://www.maggeek.com/…fabdde1bf3771e1e12fe/1432802522index.css (délai d'expiration non spécifié)
    http://www.maggeek.com/…float-to-top-button/css/img/arrow001.png (délai d'expiration non spécifié)
    http://www.maggeek.com/…uploads/2014/12/Intel-e1417382636860.png (délai d'expiration non spécifié)
    http://www.maggeek.com/…oads/2014/12/lichtreflex-421101_1920.jpg (délai d'expiration non spécifié)
    http://www.maggeek.com/wp-content/uploads/2015/04/AMD.png (délai d'expiration non spécifié)
    http://www.maggeek.com/…tent/uploads/2015/04/Geneva-E-Sport2.png (délai d'expiration non spécifié)
    http://www.maggeek.com/wp-content/uploads/2015/04/Hubble.jpg (délai d'expiration non spécifié)
    http://www.maggeek.com/wp-content/uploads/2015/04/Point-6.png (délai d'expiration non spécifié)
    http://www.maggeek.com/…content/uploads/2015/05/Barre-grise1.png (délai d'expiration non spécifié)
    http://www.maggeek.com/…ntent/uploads/2015/05/PC-BSD-150x150.jpg (délai d'expiration non spécifié)
    http://www.maggeek.com/…ads/2015/05/chromixium-logo1-150x150.png (délai d'expiration non spécifié)
    http://www.maggeek.com/wp-content/uploads/2015/05/ibmx519.jpg (délai d'expiration non spécifié)
    https://translate.googleapis.com/…ranslate_static/css/translateelement.css (60 minutes)
    https://translate.googleapis.com/…ate_static/js/element/26/element_main.js (60 minutes)
    https://translate.googleapis.com/translate_static/js/element/main_fr.js (60 minutes)

    It is very complicated to make these settings correctly…

    #111004
    Tom
    Lead Developer
    Lead Developer

    I agree – definitely not my area of expertise unfortunately.

    Perhaps your hosting will be able to help you further? All of my caching etc.. is dealt with by my server.

    #111636
    Philippe

    I have found this documentation:

    https://developers.google.com/speed/docs/insights/LeverageBrowserCaching?hl=us

    It is the host that should enable caching system. I have it contacted.

    Thank you for your support.

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.