Jump to content

Gzipping Content


random1

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.