gzip compression using php

Solutions on MaxInterview for gzip compression using php by the best coders in the world

showing results for - "gzip compression using php"
Sarah
17 Sep 2019
1<IfModule mod_deflate.c>
2  # force deflate for mangled headers
3  <IfModule mod_setenvif.c>
4    <IfModule mod_headers.c>
5      SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
6      RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
7    </IfModule>
8  </IfModule>
9 
10  # HTML, TXT, CSS, JavaScript, JSON, XML, HTC:
11  <IfModule filter_module>
12    FilterDeclare   COMPRESS
13    FilterProvider  COMPRESS  DEFLATE resp=Content-Type $text/html
14    FilterProvider  COMPRESS  DEFLATE resp=Content-Type $text/css
15    FilterProvider  COMPRESS  DEFLATE resp=Content-Type $text/plain
16    FilterProvider  COMPRESS  DEFLATE resp=Content-Type $text/xml
17    FilterProvider  COMPRESS  DEFLATE resp=Content-Type $text/x-component
18    FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/javascript
19    FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/json
20    FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/xml
21    FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/xhtml+xml
22    FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/rss+xml
23    FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/atom+xml
24    FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/vnd.ms-fontobject
25    FilterProvider  COMPRESS  DEFLATE resp=Content-Type $image/svg+xml
26    FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/x-font-ttf
27    FilterProvider  COMPRESS  DEFLATE resp=Content-Type $font/opentype
28    FilterChain     COMPRESS
29    FilterProtocol  COMPRESS  DEFLATE change=yes;byteranges=no
30  </IfModule>
31 
32  <IfModule !mod_filter.c>
33    # Legacy versions of Apache
34    AddOutputFilterByType DEFLATE text/html text/plain text/css application/json
35    AddOutputFilterByType DEFLATE application/javascript
36    AddOutputFilterByType DEFLATE text/xml application/xml text/x-component
37    AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml
38    AddOutputFilterByType DEFLATE application/atom+xml
39    AddOutputFilterByType DEFLATE image/svg+xml application/vnd.ms-fontobject
40    AddOutputFilterByType DEFLATE application/x-font-ttf font/opentype
41  </IfModule>
42</IfModule>
43
44
45<?php if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start("ob_gzhandler"); else ob_start(); ?>
46
Livia
09 Jul 2018
1
2<--!--?php if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip'))  ob_start("ob_gzhandler"); else  ob_start(); ?-->
3