Hi Guys...
I'd like to enable Brotli pre-compression for just one of my accounts who will actually be taking the time to manually Brotli compress their static assets. In reference to this thread: Using Brotli to pre-compress content, I'm clear that the general pre-compression entry needs to be added to the WHM >> Apache Configuration >> Pre VirtualHost Include section. What I'd like to know is if I could use an approach similar to the one seen here: mod_brotli - Apache HTTP Server Version 2.5 Where the compression is restricted to a particular directory to also limit the pre-compression to just one account? Something like:
If so, is <Directory> tag recursive? Will this directive apply to any and all content in the public_html directory and/or any of its subdirectories?
Thanks,
Alec
I'd like to enable Brotli pre-compression for just one of my accounts who will actually be taking the time to manually Brotli compress their static assets. In reference to this thread: Using Brotli to pre-compress content, I'm clear that the general pre-compression entry needs to be added to the WHM >> Apache Configuration >> Pre VirtualHost Include section. What I'd like to know is if I could use an approach similar to the one seen here: mod_brotli - Apache HTTP Server Version 2.5 Where the compression is restricted to a particular directory to also limit the pre-compression to just one account? Something like:
Code:
<Directory "/home/account_name/public_html">
<IfModule mod_headers.c>
# Serve brotli compressed CSS and JS files if they exist
# and the client accepts brotli.
RewriteCond "%{HTTP:Accept-encoding}" "br"
RewriteCond "%{REQUEST_FILENAME}\.br" "-s"
RewriteRule "^(.*)\.(js|css)" "$1\.$2\.br" [QSA]
# Serve correct content types, and prevent double compression.
RewriteRule "\.css\.br$" "-" [T=text/css,E=no-brotli:1]
RewriteRule "\.js\.br$" "-" [T=text/javascript,E=no-brotli:1]
<FilesMatch "(\.js\.br|\.css\.br)$">
# Serve correct encoding type.
Header append Content-Encoding br
# Force proxies to cache brotli &
# non-brotli css/js files separately.
Header append Vary Accept-Encoding
</FilesMatch>
</IfModule>
</Directory>
Thanks,
Alec