Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
general-topic
Leverage Browser Caching
Avatar
Meztli
Sweden
Member
sp_UserOfflineSmall Offline
Jul 29, 2014 - 4:59 am

Hello guys,

I am trying to speed up my site and one of the things is to implement leverage browser caching via htaccess. But i am a bit unsure if this will have negative impact at my forum.

Please look at the htaccess code below and tell me what you think!

## 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 ##
Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Jul 29, 2014 - 12:18 pm

Well I am not that well acquainted myself with htaccess rules but I do not see anything that looks like an obvious problem.

Worth noting that WordPress tends to append the wp version number to CSS and Javascript files when loading them which, I believe, means they are forced to be re-loaded when the version number changes. I would assume that these htaccess rules will not override that mechanism.

andy-signature.png
YELLOW
SWORDFISH
Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Jul 29, 2014 - 10:06 pm

yeah, the only one I would question is the expires of the js...  if you update any wp core, plugins or themes, you might want to force it...

Avatar
Meztli
Sweden
Member
sp_UserOfflineSmall Offline
Jul 30, 2014 - 3:26 am

Thank you for the advice guys.

I removed all lines except those below and it seem to work fine. GTmatrix/Pingdom and Google is happy now and giving my site better page speed and yslow rating.

## 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 image/x-icon "access 1 year"

</IfModule>

## EXPIRES CACHING ##

I really recommed leverage browser chaching and gzip compression via the htaccess file.

Cheers

 
 
Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Jul 30, 2014 - 7:51 am

Sounds good.

andy-signature.png
YELLOW
SWORDFISH
Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 620
Members: 17365
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10128
Posts: 79626