.htaccess file for enabling performance: guidance

Cheers gents!

So i’m just adding some performance details to a small site and I’m simply trying to improve speed. So after some research, and being offered several options, I went with this little bit of code:

AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
<ifModule mod_expires.c>
ExpiresActive On
ExpiresDefault A14400
ExpiresByType image/x-icon A14400
ExpiresByType application/x-javascript A14400
ExpiresByType text/css A14400
ExpiresByType image/gif A14400
ExpiresByType image/png A14400
ExpiresByType image/jpeg A14400
ExpiresByType text/plain A14400
ExpiresByType application/pdf A14400
ExpiresByType text/html A14400
</ifModule>

After running a test, my score dropped a notch and google suggested the following:

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.

so is Google essentially asking to drop a meta tag in the header with some additional details??

I’m getting up and down results right now - which is a teenie weenie annoying me. Anyhow, tutelage would be awesome.

PS - to add to the twist, when I remove the mod_expires details, I get a perf jump, but still additional warnings re: leveraging browser caching.

Thanks.

14400 seconds is only 4 hours. You’re telling browsers that their cache of images, css, js are good only for up to 4 hours. That’s not a long time. By and large, browsers are going to be stuck downloading fresh copies each time a person visits.

For static files like images, css, and js, the ideal is for them to never expire, and instead you force refreshes by changing the filename, such as by including the date or revision. For example, styles-20140909.css.

1 Like

4hrs - GOOD POINT JEFF. wasn’t thinking @ all. Here I was thinking that 1 yr would just be absurdly too long, but it makes the most sense. Jeez. Thanks for that.

Ahhh… looks like that may have done the job. hip hip! And for anyone who cares to know, i went a full yr or 29030400 (12 MONTH)

you could also improve everything by using html5boilerplate take a look at the .htaccess file what kind of stuffs are setted up there
(sadly i cannot post the direct link to the .htaccess file)

cheers;)

I took a quick look @ it moments ago - thanks again.