Search
Close this search box.

Speed Up Your Site With mod_deflate Compression

[updated_on]
Share this post:

HTTP Compression Test


AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
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

Who would have thought that adding simple mod_deflate compression code to your site’s .htaccess can make such a big difference regarding your page loading speed?

Even though there are a lot of things you can do to speed up your site, this method of WordPress page optimization is both simple and effective. Here’s how you can optimize your page using mod_deflate compression in a few easy steps.

You can either watch the detailed video tutorial below or scroll below that to read the image/text version of the tutorial.

Mod_deflate Compression Testing The Domain Name

For starters, you’ll need to check whether your site needs compression. There are numerous ways to check that, but for the purpose of this article we will this HTTP compression site http://www.whatsmyip.org/http-compression-test/.

On that page type the domain name inside the input box and click on “Test”.

Inspect The Results

After testing, you’ll need to analyze the results you got. The test will show you the page size, possible compressed page size and the percentage of potential savings.

If the results suggest that compression will be helpful, move on to the next step.

Finding The .htaccess File

Before accessing the .htaccess file, make sure that all the files in your cPanel file manager are visible.

To do so, you must enter your cPanel File Manager.

If a dialogue box appears and there’s a “show hidden files” checkbox, verify that it is checked.

If you do not see the dialogue box, you may be able to access the settings menu in the upper right corner of the File Manager. In there check the box to show the hidden files.

Paste The Code Inside The Code Editor

Without disturbing existing code in the file, just paste in the code below.


AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
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

The contents of your .htaccess file inside the code editor should look something like this.

Now click on “Save Changes”.

Verifying Compression Is Working

Finally, go back to the URL from the first step http://www.whatsmyip.org/http-compression-test/ and check whether your site is now compressed.

If you see a green check mark like in the screenshot, congratulations. Your site is now being served compressed which makes it load faster.

In Conclusion

As you might have noticed, this method is pretty similar to the GZIP compression technique.

They are both quite efficient and easy to do.

You can check out the GZIP compression method in another post and video, but I assure you that whether you choose the GZIP or mod_deflate technique, your site will work a lot faster than before applying this simple fix.

If you’re having any difficulties, leave a comment below and we’ll get back to you as soon as possible.

For customizing your WordPress site further, make sure you subscribe to my WordPress Tutorials – WPLearningLab channel and click on the bell notification not to miss any of the useful WordPress tutorials.

Share this post:

2 thoughts on “Speed Up Your Site With mod_deflate Compression”

Leave a Comment

Your email address will not be published. Required fields are marked *

WPLearningLab