• Help & contact
    • Spring Offers
      %

    Enabling GZip compression reduces the size of your website's files during transfer over the internet. This can significantly speed up page loading times, especially on slow internet connections. GZip compression works particularly well with text-based files like HTML, CSS, and JavaScript. This article will show you how to enable GZip compression.

    Enabling compression via .htaccess

    Create a .htaccess file with the following content. If you already have a .htaccess file, you can supplement the existing file with the following code block.

    <IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/xml
    AddOutputFilterByType DEFLATE text/shtml
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE application/xhtml+xml
    AddOutputFilterByType DEFLATE application/rss+xml
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/x-javascript
    </IfModule>
    apacheconf

    If you need to replace the "htaccess" file, upload this file to the website directory. Further information is available in the article Enabling GZip compression (mod_deflate).

    Enabling compression via php.ini

    Alternatively, if you're using PHP you can also activate compression via php.ini. Add the following code to a php.ini file and upload it to your website folder.

    zlib.output_compression=1
    zlib.output_compression_level=9
    mixed

    The php.ini instructions apply only to the directory where the php.ini file is located. It is best to copy the file to all the directories where PHP files are located.

    Further information is available in the Changing php Settings via php.ini article.