Can I use mod_deflate to compress files on the fly?

We have the Apache mod_deflate module available on our servers, and it can be set to compress data requested from your site.

If you have larger HTML, CSS or JavaScript files (bigger than, say, 20 KB on average), it can help the performance of your site to enable this feature.

The mod_deflate documentation explains how to enable and configure it, but the simplest setting is to add this to your .htaccess file as a single line:

AddOutputFilterByType DEFLATE text/html text/css text/plain application/javascript image/svg+xml
If you use our WordPress one-click installer, these compression rules are added by default to new sites as of February 2017, as long as you didn’t already have a .htaccess file.

What if I'm using WordPress?

The WP Super Cache plugin we recommend can compress cached files when they're created. This speeds things up even more: in most cases, the HTML pages will already be compressed, and mod_deflate won't have to do any work at all.

So if you're using WP Super Cache, you should enable the Compress pages so they're served more quickly to visitors feature (in addition to following the above instructions if necessary). That gives you the best of both worlds.

How can I tell it’s working?

A third-party test site like GiftOfSpeed can confirm that your site is sending compressed files.