Cart

    Sorry, we could not find any results for your search querry.

    Using Gzip in WordPress

    On your (WordPress) website, you have the option to use Gzip. Gzip is a form of compression, which means that if you use this on your website, the size becomes smaller. As a result, your website loads faster, and you can therefore process more traffic and the user experience as a whole becomes more pleasant.

    You enable Gzip compression your WordPress website by following the steps below.


    Activating Gzip on a webhosting package

    Log in to the control panel and click 'Shared Hosting' in the menu. Next, select your domain below 'Products'.

    Next, click 'Advanced' at the top and select 'Performance & Caching'.

    Gzip

    Gzip is enabled by clicking the sliding button next to 'GZIP compression'. Once the button is green, GZIP is activated.


    Activating Gzip on a VPS

    Open your .htaccess file with a text editor and add the following at the top of your .htaccess file:

    <IfModule mod_deflate.c> 
      # force deflate for mangled headers 
      # developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/ 
      <IfModule mod_setenvif.c> 
        <IfModule mod_headers.c> 
          SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding 
          RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding 
        </IfModule> 
      </IfModule>

      # HTML, TXT, CSS, JavaScript, JSON, XML, HTC: 
      <IfModule filter_module> 
        FilterDeclare   COMPRESS 
    FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} = 'text/html'" 
    FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} = 'text/css'" 
    FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} = 'text/plain'" 
    FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} = 'text/xml'" 
    FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} = 'text/x-component'" 
    FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} = 'application/javascript'" 
    FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} = 'application/json'" 
    FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} = 'application/xml'" 
    FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} = 'application/xhtml+xml'" 
    FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} = 'application/rss+xml'" 
    FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} = 'application/atom+xml'" 
    FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} = 'application/vnd.ms-fontobject'" 
    FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} = 'image/svg+xml'" 
    FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} = 'application/x-font-ttf'" 
    FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} = 'font/opentype'" 
        FilterChain     COMPRESS 
        FilterProtocol  COMPRESS  DEFLATE change=yes;byteranges=no 
      </IfModule>

      <IfModule !mod_filter.c> 
        # Legacy versions of Apache 
        AddOutputFilterByType DEFLATE text/html text/plain text/css application/json 
        AddOutputFilterByType DEFLATE application/javascript 
        AddOutputFilterByType DEFLATE text/xml application/xml text/x-component 
        AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml 
        AddOutputFilterByType DEFLATE application/atom+xml 
        AddOutputFilterByType DEFLATE image/svg+xml application/vnd.ms-fontobject 
        AddOutputFilterByType DEFLATE application/x-font-ttf font/opentype 
      </IfModule> 
    </IfModule>

    <IfModule !mod_deflate.c> 
        #Apache deflate module is not defined, active the page compression through PHP ob_gzhandler 
        php_flag output_buffering On 
        php_value output_handler ob_gzhandler 
    </IfModule>

    and the following immediately after <?php in wp-config.php (i.e. at the top of the file):

    ob_start('ob_gzhandler');

     

    Save the files and upload them back to your website.

     


     

    In this article we have explained how to enable GZIP compression on your webhosting package or VPS.

    Should you have any questions left regarding this article, do not hesitate to contact our support department. You can reach them via the ‘Contact Us’ button at the bottom of this page.

    Need help?

    Receive personal support from our supporters

    Contact us