Welcome to WebmasterWorld Guest from

Forum Moderators: rogerd & travelin cat

Message Too Old, No Replies

Help With Leverage Browser Caching in .htaccess



6:28 pm on Sep 12, 2011 (gmt 0)

I'm trying to speed up my site I read an article that I should add this to my .htaccess to help speed up my site. Cuz all the speed tests say I should leverage browser caching. So I added this below

<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 2 days"

Although when running different page speed tests I get this

The following cacheable resources have a short freshness lifetime. Specify an expiration at least one week in the future for the following resources:

[site1.com...] (expiration not specified)
[site2.com...] (expiration not specified)

[apis.google.com...] (1 hour)
[google-analytics.com...] (2 hours)

mysite.com/wp-content/plugins/google-analyticator/external-tracking.min.js?9d7bd4 (4 hours)
mysite.com/wp-content/plugins/simple-ads-manager/js/sam-layout.js?9d7bd4 (4 hours)
mysite.com/wp-content/plugins/wp-youtube-lyte/external/donottrack-min.js?9d7bd4 (4 hours)

mysite.com/wp-content/themes/blah-WordPress-Theme-v1.0/custom.css?9d7bd4 (4 hours)
mysite.com/wp-content/themes/blah-WordPress-Theme-v1.0/images/alert-overlay.png (4 hours)

mysite.com/wp-content/uploads/2010/11/picture.jpg?9d7bd4 (4 hours)
mysite.com/wp-content/uploads/2011/03/picture.jpg?9d7bd4 (4 hours)
mysite/wp-content/uploads/2011/03/picture.jpg?9d7bd4 (4 hours)

mysite.com/wp-includes/js/l10n.js?9d7bd4 (4 hours)

So would I add

ExpiresByType /wp-content/uploads/ "access 1 year"
ExpiresByType wp-content/themes/ "access 1 year"

Something like that?

so for each one I'm not sure how long to change the time too, I'm getting alot more errors but those are the groups of errors I'm getting. Do I just add that code to my .htaccess file and then change (4 hours) to different days or a year? If so I'm not sure how much time each group should get, hopefully this isn't too confusing.

Thanks in advance for the help my site is running ridiculously slow.


12:54 pm on Sep 13, 2011 (gmt 0)

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

Welcome to WebmasterWorld!

Do you really need/want to get into that level of control? Why not just use one of the cache plugins like W3 Total Cache?

Featured Threads

Hot Threads This Week

Hot Threads This Month