Skip to content

Instantly share code, notes, and snippets.

@ionurboz
Forked from gapple/.htaccess
Created April 3, 2023 11:53
Show Gist options
  • Save ionurboz/61a626f0c7e743e636bf73f6b518add5 to your computer and use it in GitHub Desktop.
Save ionurboz/61a626f0c7e743e636bf73f6b518add5 to your computer and use it in GitHub Desktop.
htaccess gzip/brotli-bomb
<IfModule mod_rewrite.c>
RewriteEngine On
<IfModule mod_headers.c>
RewriteCond %{HTTP:Accept-encoding} br
RewriteCond %{REQUEST_FILENAME} wp-login.php
RewriteRule ^(.*)$ bomb-32G.brotli [QSA]
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{REQUEST_FILENAME} wp-login.php
RewriteRule ^(.*)$ bomb-10G.gzip [QSA]
# Set content type, and prevent mod_deflate double compression.
RewriteRule bomb-[\d]+G\.(gzip|brotli)$ - [T=text/html,E=no-gzip:1]
<FilesMatch "(\.gzip)$">
# Serve correct encoding type.
Header set Content-Encoding gzip
Header append Vary Accept-Encoding
Header unset ETag
FileETag None
# Shared caches 1 month
Header set Cache-Control "public, no-transform, s-maxage=2592000, max-age=0"
</FilesMatch>
<FilesMatch "(\.brotli)$">
# Serve correct encoding type.
Header set Content-Encoding br
Header append Vary Accept-Encoding
Header unset ETag
FileETag None
# Shared caches 1 month
Header set Cache-Control "public, no-transform, s-maxage=2592000, max-age=0"
</FilesMatch>
</IfModule>
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment