I am using Ubuntu 14.04.4 LTS,Apache/2.4.7 and PHP 5.5.9. I installed Wordpress 4.4.2 in my machine.

When I run my site in localhost, I noticed that js/css are compressed in gzip format. I didn't install any minifier plugin in my site. Also in php.ini it is set like zlib.output_compression = Off. I checked in both .htaccess and apache2.conf, nothing is configured for gzip compression.

Can anybody point out how it is coming?

  • 1
    Check for AddOutputFilterByType DEFLATE in your Apache config. JS and CSS are probably still mentioned there. Note that it's usually a good idea to use compression, it improves the loading speed of your site. – Oldskool Apr 15 '16 at 11:49
  • if you mean in apache2.conf,it is not there.I know compression is good but needed to know how it is coming. – Hiranya Sarma Apr 15 '16 at 12:02

In Apache 2.4 under Ubuntu 14.04, the default deflate.conf file contains:

 AddOutputFilterByType DEFLATE text/css


 AddOutputFilterByType DEFLATE application/x-javascript application/javascript application/ecmascript

which add the gzip compression. This is different than using a "minifier" program, which basically rewrites text files by getting rid of whitespace.

  • how to disable for testing?just by removing those lines? – Hiranya Sarma Apr 15 '16 at 12:31
  • Either comment out those lines or, in a more broadbrush approach, dismod deflate and restart Apache. I would just comment out the lines that you are testing against. – Colt Apr 15 '16 at 12:37
  • I commented like this #AddOutputFilterByType DEFLATE application/x-javascript application/javascript application/ecmascript,and restarted apache but js files are still showing as gzip – Hiranya Sarma Apr 15 '16 at 12:39
  • Depending on how your html is written, your js files may seen by deflate as text/html or text/plain. You might try commenting out AddOutputFilterByType DEFLATE text/html text/plain text/xml as well. If not, you can try to comment out all directives in deflate.conf. If that doesn't make it stop, then it would appear that the directive has been added elsewhere. You could confirm that the deflate module is doing the compression by dismod'ing deflate. – Colt Apr 15 '16 at 12:46
  • surprisingly I didn't comment it in .htaccess – Hiranya Sarma Apr 15 '16 at 12:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.