views:

1742

answers:

4

Hello. I'm developing a website in PHP and I have large JS files that I want to compress. So, I added this in my .htaccess file:

    <FilesMatch "\.(js|css|html|htm|php|xml)$">
SetOutputFilter DEFLATE
</FilesMatch>

It works great on my local wamp server install but once I move the files on my shared server, the DEFLATE command does not work. I don't know why... mod_deflate is enabled on the webserver, aswell as bz2, gzip. I am allowed to user htaccess, I've cheched...Plus that I have other rules and commands running in htaccess. So the DEFLATE is the only one that does not work... Does anyone know why it works on my localhost and not on my webserver too ? Is there any module/extension that I need to enable on my webserver that I don't know of ?

Any ideas ?

Thank you!

+3  A: 

Are you sure mod_deflate is loaded and available? Apache doesn’t throw an error if you set it as filter although it is not loaded.

You can use the apache_get_modules function to see what modules are loaded.

Gumbo
A: 

Hmm, I guess you're right..I've checked my loaded modules with apache_get_modules() and mod_deflate wasn't there. I also checked on my localhost and mod_deflate was there. I've sent a ticket to support. I hope I'll get this done.

Thank you for your help.

Manny Calavera
A: 

Seems like a lot of shared hosting plans have disabled mod_deflate because it takes up too much CPU... at least, on the servers they cram you into.

scientastic
A: 

I'm running into the same problem right now. I am developing a Typo3 based website and would like having turned on mod_deflate on this webserver. The problem is similar to yours, it is a shared hosting and they won't turn it on because of maintaining and upgradability reasons.

Any suggestions on working around this issue, except for changing the hoster?

Alex
You could pack JS files using this: http://dean.edwards.name/packer/
Manny Calavera