Question

for some reason the gzip is not working

my gzip compression script

<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
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>

i am using:----

XAMPP server.last time updated:2 min before the time of this question

NOTE:ALL FILES ARE A .PHP FILE,AND .HTACCESS FILES ARE IN ROOT FOLDER

HOW I FOUND OUT THAT IT IS NOT BEING GZIPPED:BY RUNNING AUDIT IN GOOGLE CHROME (DEVELOPER TOOLS)

Was it helpful?

Solution 2

I'm betting your xampp install is not very old and you're probably using a recent version of Apache. So you should use mod_deflate.

mod_gzip is for Apache 1.x and mod_deflate is Apache 2.x

You can try this and customize as needed.

<IfModule mod_deflate.c>
<FilesMatch "\.(html|txt|css|js|php|pl)$">
SetOutputFilter DEFLATE
</FilesMatch>
</IfModule>

Or you can try it this way as well.

# compress text, html, javascript, css, xml:

AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE image/jpeg
AddOutputFilterByType DEFLATE image/png
AddOutputFilterByType DEFLATE image/gif

#Custom Setting End.

You may also have to enable it in the Apache config. So you would uncomment this line and restart Apache.

LoadModule deflate_module modules/mod_deflate.so

You can also see gzip info here. http://developer.yahoo.com/performance/rules.html#gzip

OTHER TIPS

Uncomment this line on httpd.conf

  • LoadModule deflate_module modules/mod_deflate.so
  • LoadModule filter_module modules/mod_filter.so
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top