2

I'm using Codeigniter a PHP framework and apache2.
I have enabled Gzip and deflate mod in apache2 and its showing phpinfo(). When I run Yslow it shows "Grade F on Compress components with gzip".
Even I changed the config.php of Codeigniter
$config['compress_output'] = TRUE;

but there is no effect. Is any thing I'm missing.

Mukesh Yadav
  • 2,256
  • 2
  • 33
  • 51

2 Answers2

2

you should enable mod_deflate just for CSS, html, js.

Ex:

<ifmodule deflate_module>
    DeflateCompressionLevel 1
    DeflateBufferSize 8096
    DeflateMemLevel 8
    DeflateWindowSize 8

    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/xml
</ifmodule>

Because images or videos are already compressed and also they take a lot of time to try to compress. Also there is a compress option on php.ini

Maybe it helps...

s3v3n
  • 8,203
  • 5
  • 42
  • 56
mazgalici
  • 608
  • 6
  • 10
1
<IfModule mod_deflate.c>
<IfModule mod_setenvif.c>
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4\.0[678] no-gzip
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
    BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
</IfModule>
<IfModule mod_headers.c>
    Header append Vary User-Agent env=!dont-vary
</IfModule>
<IfModule mod_filter.c>
    AddOutputFilterByType DEFLATE text/css application/x-javascript text/x-component text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon
</IfModule>
</IfModule>
Uri Agassi
  • 36,848
  • 14
  • 76
  • 93