Conditionally gzip files based on available compression library
I am trying to set up gzip compression on a website, but we are not sure where it will be hosted and I want to be able to support mod_gzip if it's available.
What I'd like to do is something like this:
<IfModule mod_gzip.c> # mod_gzip rules <IfOtherModule mod_deflate.c> # mod_deflate rules </IfModule>
Do apache configs allow this? Is mod_deflate smart enough not to work if mod_gzip has already done its thing?
<IfModule mod_gzip.c> # mod_gzip rules </IfModule> <IfModule !mod_gzip.c> <IfModule mod_deflate.c> # mod_deflate rules </IfModule> </IfModule>
Although I would change the order around and first try mod_defate. mod_gzip is no longer under development so you are better of using mod_deflate (which by the way also uses gzip, and not deflate, as the name might suggest).