Using gzip, the Apache webserver module mod_deflate / mod_gzip allows HTML and CSS files to be compressed, reducing the size of transferred files by up to 70%. This results in shorter loading times for your website.
Especially for visitors accessing your website with relatively slow connections (using their smartphones for example), the compression can lead to a noticeably better client performance.
Activating gzip / mod_deflate compression
You can activate gzip compression by adding an entry to the .htaccess file on your webspace.
- Access your webspace via SFTP and open the .htaccess file with a text editor (such as Notepad++).
- Paste the following code at the end of the .htcaccess file.
Activates compression only for specific MIME types (learn more about MIME types):
- Save the .htcaccess file and upload it to your webspace:
The edits to the .htcaccess file apply to the storage directory and its subdirectories respectively.
Testing gzip / mod_deflate compression
You can test the gzip / mod_deflate compression with Google PageSpeed Insights for example. You can also use the developer tools of your browser (Chrome or Firefox for example) to display the content-encoding information for your website.
Open your website with the browser of your choice, activate developer tools and switch to the Header tab. Look for Content-Encoding: gzip.
Please note: A small number of webhosting packages might need additional adjustments to enable gzip. If you need help enabling gzip, please contact our support team.
You might also be interested in
Activate 1&1 CDN for a Domain (1&1 Help Center)