Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.