Link to home
Start Free TrialLog in
Avatar of kranthi_50404
kranthi_50404Flag for India

asked on

Apache server

Hello, i am using mod_defalte module for compression at server end and i want to compress only css and js and uncompress rest of files only for browser IE 6.0 and i have used the following code which is not working please find code snippet attached.
LoadModule deflate_module @@APACHE_DIR@@/modules/mod_deflate.so
 
<Location />
                                                                                                                             
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/atom_xml
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE text/html
 
BrowserMatch \bMSIE/s6\.0 !no-gzip !gzip-only-text/css text/javascript
 
SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.avi$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.mov$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.mp3$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.mp4$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.rm$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.swf$ no-gzip dont-vary
                                                                                                                             
</Location>

Open in new window

Avatar of ralphcarey
ralphcarey

Hi,

This isn't a complete solution and I'm not an expert on Apache but I have been looking at compression over the last couple of days and found that the following lines work. They are less verbose than those you are currently using and so possibly easier to edit to meet your requirements:

##ZIP/DEFLATE/COMPRESS
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript text/css
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
Header append Vary User-Agent env=!dont-vary
##LOG FOR ZIP/DEFLATE/COMPRESS
DeflateFilterNote deflate_ratio
LogFormat "%v %h %l %u %t \"%r\" %>s %b mod_deflate: %{deflate_ratio}n pct." vhost_with_deflate_info
CustomLog /var/log/deflate_access_log vhost_with_deflate_info

The log lines are useful because they show how much pages are being compressed, but if you do not want to know then omit them.

Avatar of kranthi_50404

ASKER

well that is fine ... i specifically want to compress only css files for IE 6.0 and rest of the files should be uncompressed and for other browsers it should compress every thing except image file(png, gpeg..exc) and pdf files...the above code doesn't do that...
ASKER CERTIFIED SOLUTION
Avatar of caterham_www
caterham_www
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial