I want to add the following code to my htaccess but it does not work.
# ----------------------------------------------------------------------
# | Brotli pre-compressed content |
# ----------------------------------------------------------------------
# Serve brotli compressed CSS, JS, HTML, SVG, ICS and JSON files
# if they exist and if the client accepts br encoding.
#
# (!) To make this part relevant, you need to generate encoded
# files by your own. Enabling this part will not auto-generate
# brotlied files.
#
# Note that some clients (eg. browsers) require a secure connection
# to request brotli-compressed resources.
# https://www.chromestatus.com/feature/5420797577396224
#
# https://httpd.apache.org/docs/current/mod/mod_brotli.html#precompressed
<IfModule mod_headers.c>
RewriteCond %{HTTP:Accept-Encoding} br
RewriteCond %{REQUEST_FILENAME}\.br -f
RewriteRule \.(css|ics|js|json|html|svg)$ %{REQUEST_URI}.br [L]
# Prevent mod_deflate double gzip
RewriteRule \.br$ - [E=no-gzip:1]
<FilesMatch "\.br$">
<IfModule mod_mime.c>
# Serve correct content types
AddType text/css css.br
AddType text/calendar ics.br
AddType text/javascript js.br
AddType application/json json.br
AddType text/html html.br
AddType image/svg+xml svg.br
# Serve correct content charset
AddCharset utf-8 .css.br \
.ics.br \
.js.br \
.json.br
</IfModule>
# Force proxies to cache brotlied and non-brotlied files separately
Header append Vary Accept-Encoding
</FilesMatch>
# Serve correct encoding type
AddEncoding br .br
</IfModule>
h5bp/html5-boilerplate:dist/.htaccess@master
#L897-L949
Does not work in root and also not in pub.