You may be instructed to compress with GZIP to optimize the speed of your website, especially if you use tools such as GTMetrix, Pingdom, Page Speed Insights, or YSlow.
The following describes how GZIP is enabled at DreamHost.
What is GZIP Compression?
GZIP Compression is a method to help speed up the loading of websites by reducing the size of certain files for transfer from the website’s server to the visitor’s computer or device. For example, a 1 MB web page in size may only need to transfer 800 KB instead.
Loading a 1 MB page can actually be over 25% slower than loading an 800 KB page, so making sure you take advantage of compression might mean a faster-loading site.
Does DreamHost enable GZIP Compression?
DreamHost enables GZIP compression by default on all web hosting plans, so you do not need to take any further steps to turn it on for your site.
If GZIP is enabled by default, why does my site optimization tool tell me I need to compress with GZIP?
There are a few reasons why some website analyzer services may tell you that you need to compress some files with GZIP even though it is already enabled for your HTTP site. This includes:
- The URLs they report needing compression are for a third-party site, not your domain. In this case, DreamHost cannot control compression on a third-party site. To compensate, you can ask the third-party site if they can compress or create some alternative for their URLs, or you can remove the URLs from your page’s code and replace them with URLs on your own site or URLs on a third-party site that can compress those files.
- You have made your website HTTPS only, where all pages and URLs load on https:// instead of http://. Due to a security vulnerability that is described in the previous section, GZIP compression is turned off for HTTPS.
- You may have an .htaccess file on your site with code that overrides GZIP compression. If you have http:// URLs on your domain appearing as needing compression, you can review the code in your .htaccess file and make corrections as needed. If you are not familiar with the code in the .htaccess file, you can also try temporarily changing the name of .htaccess to .htaccess_off and try loading the page again. To make sure other functionality on your site doesn’t break permanently, remember to rename the .htaccess_off file back to .htaccess.
Alternatives to GZIP Compression for HTTPS
There are a couple options you can use that allow the compression of some files on your HTTPS site even without GZIP compression, while also mitigating the security vulnerability mentioned above. If you use the following methods and test your site using a website analyzer service, you should not see any results which say files on your domain should be compressed.
Cloudflare is a service that provides website protection and acceleration. Cloudflare's primary feature is its global Content Delivery Network (CDN), which provides web content optimization technologies that improve how quickly resources on your site load. All Cloudflare plans including its free plans offer Brotli compression by default, which is a newer and faster method of compression. For more information on enabling Cloudflare, please see the following article:
If you have a WordPress site, you can upgrade your site to DreamPress, where Brotli compression is also enabled by default without any additional work. DreamPress is DreamHost's managed WordPress hosting. It's a scalable service that allows users to manage their WordPress sites with simple pricing, added benefits of server robustness, caching, and memory. For more information on upgrading your One-Click Install of WordPress to DreamPress, please see the following article: