random1 Posted April 2, 2009 Share Posted April 2, 2009 I have the following code to gzip content: # Compress content <IfModule mod_gzip.c> mod_gzip_on yes mod_gzip_dechunk yes mod_gzip_keep_workfiles No mod_gzip_temp_dir /tmp mod_gzip_minimum_file_size 1002 mod_gzip_maximum_file_size 1000000 mod_gzip_maximum_inmem_size 1000000 mod_gzip_item_include file \.htm$ mod_gzip_item_include file \.html$ mod_gzip_item_include file \.php$ mod_gzip_item_include mime ^text/.* mod_gzip_item_include mime ^application/x-httpd-php mod_gzip_item_include mime ^httpd/unix-directory$ # mod_gzip_item_exclude file "\.js$" mod_gzip_item_exclude file "\.wml$" mod_gzip_item_exclude reqheader "User-Agent: .*Mozilla/4\..*\[" mod_gzip_item_exclude mime ^image/.gif mod_gzip_item_exclude mime ^image/.png </IfModule> # Deflate files as per sever logic <IfModule mod_deflate.c> SetOutputFilter DEFLATE RewriteEngine On AddEncoding x-gzip .gz RewriteCond %{HTTP:Accept-encoding} gzip RewriteCond %{HTTP_USER_AGENT} !Safari RewriteCond %{REQUEST_FILENAME}.gz -f RewriteRule ^(.*)$ $1.gz [QSA,L] </IfModule> It is partially working but it does not gzip .js files. How can it be updated to gzip .js files and other suitable files? Link to comment https://forums.phpfreaks.com/topic/152189-gzipping-content/ Share on other sites More sharing options...
corbin Posted April 2, 2009 Share Posted April 2, 2009 Easiest way would be to just add mod_gzip_item_include file \.js$ Link to comment https://forums.phpfreaks.com/topic/152189-gzipping-content/#findComment-799924 Share on other sites More sharing options...
random1 Posted April 6, 2009 Author Share Posted April 6, 2009 Hmm... that doesn't fix it up. I found and tried: # Compress content <FilesMatch "\.(js|css)$"> SetOutputFilter DEFLATE </FilesMatch> from: http://www.askapache.com/htaccess/apache-speed-compression.html but this also doesn't seem to work. I am using Apache 2 and have 'mod_deflate' enabled. Link to comment https://forums.phpfreaks.com/topic/152189-gzipping-content/#findComment-802001 Share on other sites More sharing options...
gffg4574fghsDSGDGKJYM Posted April 6, 2009 Share Posted April 6, 2009 weird..it should work, maybe the error is here : mod_gzip_minimum_file_size 1002 mod_gzip_maximum_file_size 1000000 What the size of your .js file ? Wait did you use mod_gzip OR mod_deflate ? (or both?) Link to comment https://forums.phpfreaks.com/topic/152189-gzipping-content/#findComment-802007 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.