Welcome to WebmasterWorld Guest from 34.207.78.157

Forum Moderators: not2easy

Message Too Old, No Replies

cache control

Google speed test wants cache control

     
7:32 pm on Sep 30, 2016 (gmt 0)

Preferred Member

10+ Year Member Top Contributors Of The Month

joined:Feb 10, 2005
posts: 497
votes: 0


Google speed test demands some "Leverage browser caching
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.

and such .htaccess entries don't seem to please them ...

Does anyone have an idea how to make it work ?

<IfModule mod_expires.c>
ExpiresActive On
<FilesMatch "\.(|ico|js|gif|jpg|jpeg|png|swf)$">
ExpiresDefault A29030400
</FilesMatch>
</IfModule>

or

ExpiresActive On
ExpiresDefault “access plus 1 week”
ExpiresByType text/css M604800
9:02 pm on Sept 30, 2016 (gmt 0)

Administrator from US 

WebmasterWorld Administrator not2easy is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Dec 27, 2006
posts:4296
votes: 288


There have been a few discussions in the Apache Forum about this topic, but because it depends on the server setup, the configuration of the server I believe it is best to consult with the host for a definitive answer. If you like, you can try and test some of the suggested methods. Remember that the "ExpiresActive ON" and "Expires Default" set the basics and additional controls for files that change more frequently or files you do not want cached are what you should work on.

The formats are explained at the Apache site: [httpd.apache.org...] and you can see a few past discussions in the Apache Forums here: [webmasterworld.com...] and also here: [webmasterworld.com...] that may help. Because the "best" way to do this depends on the type of files, whether they are static or dynamically generated and on the server's settings, there are a lot of variables. Best practice is to read and try, by using tools to check the headers, clearing your cache and testing.

Setting Expires headers for dynamically generated files (such as Drupal or WordPress generates) is best done internally - within the CMS rather than in .htaccess because the "files" don't exist until they are requested.
8:55 am on Oct 1, 2016 (gmt 0)

Preferred Member

10+ Year Member Top Contributors Of The Month

joined:Feb 10, 2005
posts: 497
votes: 0


many thanks for the links not2easy
9:52 am on Oct 1, 2016 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member keyplyr is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Sept 26, 2001
posts:12913
votes: 893


Just. FYI - even if you do install correct caching and it is working as intended, Page Speed may not recognize it and may return the same "Leverage browser caching" warning so it's best to validate at another tool (or more.)

Also, if using HTTPS, Page Speed results may also report caching warning depending on the header your server returns.
7:32 am on Oct 2, 2016 (gmt 0)

Preferred Member

10+ Year Member Top Contributors Of The Month

joined:Feb 10, 2005
posts: 497
votes: 0


Indeed, other page tests confirm valid browser caching andi have tried various methods, but none does not please page speed ... so i am still searching for a functioning entry.

Perhaps someone may have a functioning htaccess entry?
8:05 am on Oct 2, 2016 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member keyplyr is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Sept 26, 2001
posts:12913
votes: 893


Don't worry about it. Not passing all the rules at Page Speed means nothing in terms of your page ranking. The tool is buggy.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members