Enable compression in Apache using htaccess
Question:
How to enable compression in Apache using htaccess? Answer:
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
</IfModule>
Description:
The mod_deflate
module provides the DEFLATE
output filter that allows output from your server to be compressed before being sent to the client over the network.
Reference:
Apache's mod_deflate module reference
Share "How to enable compression in Apache using htaccess?"
Related snippets:
- Change default terminal in VS Code
- Change colors in VS Code integrated terminal
- Change file encoding in VS Code
- Setup HTTPS for local development on Windows 10
- Add cookie in Chrome
- Setup xdebug 3 debugger for PHP
- Set default encoding to UTF-8 using Apache
- Enable compression in Apache using htaccess
- Cache static content using htaccess
- Redirect all requests to index.php using htaccess
- Set X-Frame-Options on Apache webservers
- Redirect www to non-www on Apache webservers
- Automatically redirect HTTP to HTTPS on Apache webservers
- Set X-Content-Type-Options in Apache
Tags:
enabe compression, compress response, compress css, compress html, compress javascript Technical term:
Enable compression in Apache using htaccess