# Compression Gzip, Brotli

Source: https://www.hukot.net/community/en/tutorials/compression-gzip-brotli
Updated: 2026-11-26

On web hosting servers at Hukot.net, we support three compression formats, widely used and supported **Gzip, Deflate**, and also the newer, often more efficient, algorithm **Brotli** from Google. Compression reduces the data demand for transmitted data from the server and speeds up the loading of web pages.

### Example of effective compression usage (.htaccess):

```
# Rules for proper delivery of compressed CSS and JS files.

<IfModule mod_headers.c>

RewriteEngine On

# Serves Brotli compressed CSS files if they exist and the client accepts br.

RewriteCond %{HTTP:Accept-encoding} br

RewriteCond %{REQUEST_FILENAME}\.br -s

RewriteRule ^(.*)\.css $1\.css\.br [QSA]

# Serves gzip compressed CSS files if they exist and the client accepts gzip.

RewriteCond %{HTTP:Accept-encoding} gzip

RewriteCond %{REQUEST_FILENAME}\.gz -s

RewriteRule ^(.*)\.css $1\.css\.gz [QSA]

# Serves Brotli compressed JS files if they exist and the client accepts br.

RewriteCond %{HTTP:Accept-encoding} br

RewriteCond %{REQUEST_FILENAME}\.br -s

RewriteRule ^(.*)\.js $1\.js\.br [QSA]

# Serves gzip compressed JS files if they exist and the client accepts gzip.

RewriteCond %{HTTP:Accept-encoding} gzip

RewriteCond %{REQUEST_FILENAME}\.gz -s

RewriteRule ^(.*)\.js $1\.js\.gz [QSA]

# Provides the correct content types and prevents double gzip.

RewriteRule \.css\.gz$ - [T=text/css,E=no-gzip:1]

RewriteRule \.js\.gz$ - [T=text/javascript,E=no-gzip:1]

RewriteRule \.css\.br$ - [T=text/css,E=no-gzip:1]

RewriteRule \.js\.br$ - [T=text/javascript,E=no-gzip:1]

<FilesMatch "(\.js\.gz|\.css\.gz)$">

# Provides the correct encoding type.

Header set Content-Encoding gzip

# Forces the proxy to cache gzip and non-gzip files for CSS/JS separately.

Header append Vary Accept-Encoding

</FilesMatch>

<FilesMatch "(\.js\.br|\.css\.br)$">

# Provides the correct encoding type.

Header set Content-Encoding br

# Forces the proxy to cache gzip and non-gzip files for CSS/JS separately.

Header append Vary Accept-Encoding

</FilesMatch>

</IfModule>
```
