Enable GZIP Compression
To enable Gzip compression using mod_deflate
on a website:
- SSH into the website you want to enable Gzip compression on.
- Open or create a
.htaccess
file in the top-level directory. - Copy and paste the following code into the
.htaccess
file:
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/shtml
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
</IfModule>
- Save the file.
This will compress HTML, CSS, and JavaScript files using Gzip to improve website performance.