Support » Plugin: WP Super Cache » Google PageSpeed Insights suggests "Leverage browser caching"

  • I am using WP Super Cache plugin on my website http://www.prosoccerrebounder.net/ and I recently checked my site on google page speed insights. I am getting the following fix message

    “Setting an expiry date or a maximum age in the HTTP headers for static resources instructs the browser to load previously downloaded resources from local disk rather than over the network.”

    Can I fix this problem via WP super cache settings like through garbage collection?

    My current cache timeout is 604800 seconds and timer is 604800 seconds too. I use Autoptimize plugin as well.

    Anyone’s quick help is appreciated.

    https://wordpress.org/plugins/wp-super-cache/

Viewing 11 replies - 1 through 11 (of 11 total)
  • Any solution from the plugin developer or experts?

    Its bad that developers are ingoring this question all the time from thousends people. I think we must mark 1 star and change plugins.

    Sergey9999, have you tried to add browser caching directly to your .htaccess file (assuming you are on Apache-based server, which is the standard)? If not, try add the following:

    ##### EXPIRE CACHING - LEVERAGE BROWSER CACHING #####
    <IfModule mod_expires.c>
    ExpiresActive On
    ExpiresDefault "access plus 1 month 1 days"
    ExpiresByType text/html "access plus 1 month 1 days"
    ExpiresByType image/gif "access plus 1 month 1 days"
    ExpiresByType image/jpeg "access plus 1 month 1 days"
    ExpiresByType image/png "access plus 1 month 1 days"
    ExpiresByType text/css "access plus 1 month 1 days"
    ExpiresByType text/javascript "access plus 1 month 1 week"
    ExpiresByType application/x-javascript "access plus 1 month 1 days"
    ExpiresByType text/xml "access plus 1 seconds"
    </IfModule>
    ##### END EXPIRE CACHING #####

    Glad it helped. Good luck with the PageSpeed optimization.

    Moderator Steve Stern

    (@sterndata)

    Support Team Volunteer

    Mojamba: +1 on the thanks!

    Thanks for the suggestion mojamba

    W3 total cache is slower than supercache

    For anyone who sees this…

    Leveraging Browser Caching can be done very easily by just adding a block (see mojamba’s response above) to your htaccess. The devs are responding or caring much because the ease of adding it yourself is ridiculously simple.

    As a side note: I also see people complaining about not all things being leveraged, but you need to understand that you can only leverage browser caching for files located on your own server. Therefore, if your page or site calls a script that uses an off-server resource, and the resource it’s calling isn’t being leveraged by where it’s coming from, then you can’t change that.

    A good example of this is actually a lot of Google’s script sources, which I find INCREDIBLY frustrating. I don’t even add analytics or certain things like that anymore because of their lack of regard for extending the cache on their resources. So ironic too when you think about it. To have 100/100 pagespeed scores, and then it becomes 99/100 because you get dinged one point after adding something that calls an unleveraged resource straight from the internet gods themselves (Google).

    When I run pagespeed insights

    I get a list of URL’s that are not cached

    https://s7.addthis.com/js/300/addthis_widget.js (expiration not specified)
    https://m.addthisedge.com/…-581fed4a01853107/_ate.track.config_resp (60 seconds)
    https://connect.facebook.net/en_US/fbevents.js (20 minutes)
    https://www.google-analytics.com/plugins/ua/ec.js (60 minutes)
    https://www.google-analytics.com/plugins/ua/linkid.js (60 minutes)
    https://www.google-analytics.com/analytics.js (2 hours)

    How do I add these to my .htaccess

    ##### EXPIRE CACHING - LEVERAGE BROWSER CACHING #####
    <IfModule mod_expires.c>
    ExpiresActive On
    ExpiresDefault "access plus 1 month 1 days"
    ExpiresByType text/html "access plus 1 month 1 days"
    ExpiresByType image/gif "access plus 1 month 1 days"
    ExpiresByType image/jpeg "access plus 1 month 1 days"
    ExpiresByType image/png "access plus 1 month 1 days"
    ExpiresByType text/css "access plus 1 month 1 days"
    ExpiresByType text/javascript "access plus 1 month 1 week"
    ExpiresByType application/x-javascript "access plus 1 month 1 days"
    ExpiresByType text/xml "access plus 1 seconds"
    </IfModule>
    ##### END EXPIRE CACHING #####

    I have expires cache in my .htaccess file already.

    As tuccimane already wrote:
    “you need to understand that you can only leverage browser caching for files located on your own server. Therefore, if your page or site calls a script that uses an off-server resource, and the resource it’s calling isn’t being leveraged by where it’s coming from, then you can’t change that.”

    As you will notice, all those resources you listed are from domains you cannot control.

    I did notice that thank you for helping to make it more clear!

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Google PageSpeed Insights suggests "Leverage browser caching"’ is closed to new replies.