homepage Welcome to WebmasterWorld Guest from 54.226.168.96
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Accredited PayPal World Seller

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / WordPress
Forum Library, Charter, Moderators: lorax & rogerd

WordPress Forum

    
Help With Leverage Browser Caching in .htaccess
ibmethatswhoib2




msg:4361512
 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

## EXPIRES CACHING ##
<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"
</IfModule>
## EXPIRES CACHING ##

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.

 

lorax




msg:4361896
 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.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved