Sign Up / Log In
Need help?
1300 210 210
We're Australian!
#1 for domains & hosting
94% customer satisfaction
Trusted by over 1 million businesses
Expert, 24/7 customer support
90% of issues resolved within a day
Best value
We price match*
Online Support Web Hosting

How to enable GZIP compression

There are several ways to increase a website’s speed. Enabling GZIP compression from the server is one standard practice. While GZIP is commonly known as a file format, it is also a software application responsible for reducing the size of files (HTML, stylesheets, JavaScript, etc.). It allows a server to provide compressed files to the browser for a faster network transfer. This is an easy way to optimize your website and improve user experience.

You can enable GZIP compression using two different Apache mods: mod_deflate and mod_gzip. Both allow compression from the server before files are sent to a browser. However, mod_deflate is recommended. It is more widely supported than mod_gzip. In addition, it is documented better and configured easily. If it’s dysfunctional, you can use mod_gzip. We have provided both Apache mods below for your reference.

Enable GZIP compression

Here's a detailed instruction to enable GZIP compression in the .htaccess file:

  1. Click Sign Up / Log In at the top of this page.
  2. Select Hosting Manager from the drop-down menu.
  3. Enter your username and password, and click Log In.
  4. On the Home page, click the Files icon or the [ v ] arrow symbol on its right side.
  5. Click on the File Manager icon next to Directory Privacy.
  6. In the pop-up box, make sure to choose Web Root and tick the box that says Show Hidden files (dot files).
  7. Click Go.
  8. Right-click on the .htaccess file, select Edit.
  9. A code editor popup will display, click Edit.
  10. Add one of the following scripts inside the .htaccess file:

    Enable mod_deflate (recommended):

    <IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE text/javascript
    AddOutputFilterByType DEFLATE text/xml
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE image/x-icon
    AddOutputFilterByType DEFLATE image/svg+xml
    AddOutputFilterByType DEFLATE application/rss+xml
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/x-javascript
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE application/xhtml+xml
    AddOutputFilterByType DEFLATE application/x-font
    AddOutputFilterByType DEFLATE application/x-font-truetype
    AddOutputFilterByType DEFLATE application/x-font-ttf
    AddOutputFilterByType DEFLATE application/x-font-otf
    AddOutputFilterByType DEFLATE application/x-font-opentype
    AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
    AddOutputFilterByType DEFLATE font/ttf
    AddOutputFilterByType DEFLATE font/otf
    AddOutputFilterByType DEFLATE font/opentype
    # For Olders Browsers Which Can't Handle Compression
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4\.0[678] no-gzip
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
    </IfModule>

    Enable mod_gzip:

    <ifModule mod_gzip.c>
    mod_gzip_on Yes
    mod_gzip_dechunk Yes
    mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
    mod_gzip_item_include handler ^cgi-script$
    mod_gzip_item_include mime ^application/x-javascript.*
    mod_gzip_item_include mime ^text/.*
    mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
    mod_gzip_item_exclude mime ^image/.*
    </ifModule>
  11. Click Save Changes at the upper right-hand corner.

Congratulations! You have compressed your website files.

Was this helpful? Yes No 85% of people found this helpful.
we're
online
Need Help? Chat Now