Skip to content

Instantly share code, notes, and snippets.

@keithgreer
Last active July 5, 2023 12:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keithgreer/c5a2d30ea3bdc10eed67792f33231061 to your computer and use it in GitHub Desktop.
Save keithgreer/c5a2d30ea3bdc10eed67792f33231061 to your computer and use it in GitHub Desktop.
.htaccess: Enable GZIP Compression for Magento https://keithgreer.dev/htaccess-enable-gzip-compression-magento/
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
Header append Vary User-Agent env=!dont-vary
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment