homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / WordPress
Forum Library, Charter, Moderators: lorax & rogerd

WordPress Forum

Help With Leverage Browser Caching in .htaccess

Msg#: 4361510 posted 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)

https://apis.google.com/js/plusone.js (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.



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

Msg#: 4361510 posted 12:54 pm on Sep 13, 2011 (gmt 0)

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?

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / WordPress
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved