Jump to content

How active gzip via htaccess?


Recommended Posts

Add the following to your .htaccess file

    # BEGIN GZIP COMPRESSION
    <IfModulemod_gzip.c>
    mod_gzip_onYes
    mod_gzip_dechunkYes
    mod_gzip_item_includefile.(html?|txt|css|js|php|pl)$
    mod_gzip_item_includehandler^cgi-script$
    mod_gzip_item_includemime^text/.*
    mod_gzip_item_includemime^application/x-javascript.*
    mod_gzip_item_excludemime^image/.*
    mod_gzip_item_excluderspheader^Content-Encoding:.*gzip.*
    </IfModule>
    # END GZIP COMPRESSION

Or if you were using Nginx (for future reference), you would add this to your config file (nothing you need to worry about, since you are using Apache).

    gzipon;
    gzip_comp_level2;
    gzip_http_version1.0;
    gzip_proxied any;
    gzip_min_length1100;
    gzip_buffers168k;
    gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
    gzip_varyon;

 

Edited by Linux-Is-Best
clarity
Link to comment
Share on other sites

  • 2 weeks later...
On 6/12/2021 at 9:56 PM, Linux-Is-Best said:

Add the following to your .htaccess file

    # BEGIN GZIP COMPRESSION
    <IfModulemod_gzip.c>
    mod_gzip_onYes
    mod_gzip_dechunkYes
    mod_gzip_item_includefile.(html?|txt|css|js|php|pl)$
    mod_gzip_item_includehandler^cgi-script$
    mod_gzip_item_includemime^text/.*
    mod_gzip_item_includemime^application/x-javascript.*
    mod_gzip_item_excludemime^image/.*
    mod_gzip_item_excluderspheader^Content-Encoding:.*gzip.*
    </IfModule>
    # END GZIP COMPRESSION

Or if you were using Nginx (for future reference), you would add this to your config file (nothing you need to worry about, since you are using Apache).

    gzipon;
    gzip_comp_level2;
    gzip_http_version1.0;
    gzip_proxied any;
    gzip_min_length1100;
    gzip_buffers168k;
    gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
    gzip_varyon;

 

great, thanks a lot.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...