Enable GZIP Compression
Enabling mod_deflate on your website allows the server to compress HTML, CSS, and JavaScript files using Gzip before sending them to the browser. This significantly reduces the size of your data transfers, leading to faster page load times and reduced bandwidth usage.
How to Enable Gzip
Gzip compression is managed via your website's .htaccess file. You can edit this file via the File Manager or SSH.
- Access your website files via SSH or the File Manager.
- Locate the
.htaccessfile in yourpublic_htmlor top-level directory. If it doesn't exist, create a new file named.htaccess. - Copy and paste the following configuration block into the 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>
Verification Tip
After saving the file, you can verify compression is working by checking your site on tools like GTmetrix or using the browser inspector to look for the content-encoding: gzip header in the Network tab.