Guides

How to enable gzip and brotli compression

Compression shrinks your HTML, CSS, and JavaScript on the server, so pages load faster and use less bandwidth. Turn it on as soon as you see a heavy page size or a missing Content-Encoding header in a speed test.

Check your site

>
  1. Enable compression in cPanel

    In cPanel, open Optimize Website in the Software section and choose Compress All Content. This turns on gzip for text responses without editing any files.

  2. Add gzip rules to .htaccess

    If the panel has no such option, open .htaccess in your site root through File Manager and add a mod_deflate block with AddOutputFilterByType DEFLATE lines for text/html, text/css, application/javascript, and application/json.

  3. Enable brotli if the server supports it

    Brotli compresses text tighter than gzip. On LiteSpeed hosting a cache plugin or a panel option turns it on; on Apache you need mod_brotli and an AddOutputFilterByType BROTLI_COMPRESS directive.

  4. Compress text types only

    Add html, css, js, json, xml, svg, and fonts to the rules. Images like jpg, png, and webp are already compressed, so leave them out, since re-compressing only wastes CPU.

  5. Clear the cache and reload

    After the change, clear your site cache (in WordPress via the cache plugin) and your browser cache so the server hands back the newly compressed page.

How to verify the result

Run the TechGuard speed test again: the response should now carry Content-Encoding: gzip or br, and the page size should drop noticeably. That confirms compression is actually working.

Tip: Do not enable compression in both Optimize Website and .htaccess, because double compression can serve the page as unreadable garbled text.

Related guides

Found problems?

Slow hosting, SSL trouble or frequent downtime? Move to TomisHost: fast hosting with free SSL, daily backups and free migration help.

TomisHost hosting