mod_deflate: Best way to compress? Via Cpanel vs .htaccess vs php snippet?

mod_deflate: Best way to compress? Via Cpanel vs .htaccess vs php snippet? Im trying to speed up my site. compression is one of the ways i intend to do it. Those are all the ways I’ve found. What are the plus and minuses of each? Do you prefer one way over the other and why? Thanks!

Ps. Hostgator only uses mod_deflate as far as I know. O is that just in the Cpanel way. Maybe I could gzip or other using one of the other methods??

Ok I been reading. I’m going with the htaccess one. Just need to fine tune that code. There are 10 different versions on the web.

Ok here is the best I could find. Hello anyone know better?

I typically look at the htaccess file fould in the HTML5 boiler plate for ideas and techniques, since they’re vetted by a group of web developers:

You’ll find their htaccess file compression solution in there (which I use on the websites I develop).

the html5 boilerplate is great if you know what to loo for, but sometimes there are things that you will never use, so i use it like you do, to get ideas :slight_smile:

OK here is what I ended up with. After reading for weeks on this I think this is the best setup. The only thing it seems I went out on a limb on is caching html for a long time. I toyed with this in my brain. Many say cache css for a long time. Well I can’t cache css, or js for that matter, without caching the html. When ever I edit one 9 times out of 10 I’m editing one of the others. Well if one is a new copy and one isn’t the user will very likely see something wonky or unstyled, or un-js’ed.

My question is this? Am I missing something about caching the html? Or is the only downside the user waits 90 days to see the updated copy? Additionally Google always sees the newset copy correct? Thanks for your knowledge!

Compress Files

<FilesMatch “\.(js|css|html|php|xml)$”>
SetOutputFilter DEFLATE

Turn off the ETags

Header unset ETag
FileETag None

Cache Files 90 Days

<filesMatch “\.(html|css|js|swf|pdf|xml|mp3|gif|jpg|png)$”>
ExpiresActive On
ExpiresDefault “access plus 90 days”
Header append Cache-Control “public”