Forum Moderators: phranque

Message Too Old, No Replies

Compress files

How to ompress static files like CSS and JavaScript

         

crosescu

12:33 am on Feb 26, 2010 (gmt 0)

10+ Year Member



Hi,

I use Apache 1.3 with the mod_gzip module loaded on the server.
I'd like to compress all the static files like CSS and JavaScript

I have the code below in my .htaccess file on the root but for some reason it still says that the files are not compressed.
Any ideas? am I missing something?

<IfModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl|jpg|png|gif)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</IfModule>

Thank you for your help in advance

jdMorgan

4:04 pm on Feb 26, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm not a mod_gzip expert, so the only comment I can offer is that trailing ".*" sub-patterns on regex patterns having no end-anchor are meaningless -- a waste of bytes. Since ".*" means "Match anything, everything, or blank," the results are the same whether you include that subpattern or omit it on a non-end-anchored pattern.

Just make sure you're deleting your browser cache after every server config change, and restarting your server if these changes are in a server config file (as opposed to .htaccess). In addition, checking your server responses with something like the "Live HTTP Headers" add-on for Firefox and other Mozilla-based browsers may give you some useful information.

Jim