How to Enable Gzip Compression via .htaccess

Gzip compression reduces the file size of your web pages, stylesheets, and scripts before they're sent to a visitor's browser. The result is faster load times and reduced bandwidth usage - a win for both your visitors and your hosting account.

How to Enable Gzip Compression

Add the following code to your .htaccess file in your public_html directory. Place it outside of any existing WordPress or application blocks:

<IfModule mod_deflate.c> AddOutputFilterByType DEFLATE text/html AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE text/javascript AddOutputFilterByType DEFLATE text/xml AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE application/javascript AddOutputFilterByType DEFLATE application/x-javascript AddOutputFilterByType DEFLATE application/xml AddOutputFilterByType DEFLATE application/xhtml+xml AddOutputFilterByType DEFLATE application/rss+xml AddOutputFilterByType DEFLATE application/json </IfModule>

Does It Work on dotCanada?

Yes. dotCanada's shared hosting runs on LiteSpeed, which supports the mod_deflate module and honours these .htaccess directives. In many cases, LiteSpeed also applies its own built-in compression, but explicitly setting it in .htaccess ensures consistent behaviour.

Testing Your Compression

After saving your changes, use a tool like GTmetrix or Google PageSpeed Insights to verify that compression is active. You should see Gzip or Brotli listed as enabled in the results.

If you have any trouble enabling compression or want advice on further performance optimisations, contact our support team.

100% Satisfaction Guarantee

We're so confident you'll love dotCanada that we offer a 30-day money-back guarantee. Not satisfied? Get a full refund, no questions asked.

Ready to Get Started?

Join thousands of Canadian website owners who trust dotCanada for reliable, fast web hosting.

Get Started Today