Use Gzip to Speed Up WordPress, Drupal or Joomla

| Web Design
Use Gzip to Speed Up WordPress, Drupal or Joomla

Gzip compression is an effective way to save bandwidth and speed up your site. Set it once and reap the reward of substantially increased speed of your webpages for the time of its life.

Your website speed is an important factor that impacts every aspect of your website, including user experience, purchases, shares, and search engine ranking.

Gzip compression is one of the easiest and most effective ways to improve your site’s performance. Similar to how you zip files on your computer, Gzip reduces the file size of each page your server sends to the recipient browser. Reducing file size results in faster page rendering.

WordPress Gzip Activation

There are 3 free methods to activating Gzip on a WordPress-powered website. The fastest and easiest way is to use a plugin. Both W3 Total Cache and WP Super Cache offer Gzip parameters.

The alternative is to modify the .htaccess file. Simply add the following code:

<IfModule mod_deflate.c>
# Compress HTML, CSS, JavaScript, Text, XML and fonts
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE font/opentype
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
# Remove browser bugs (only needed for really old browsers)
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent
</IfModule>

Joomla! Gzip Activation

Thanks to the dedicated Joomla! developers, activating Gzip on a Joomla! website does not require additional plugins. In fact, you can activate it with only 3 clicks. Go to the administrative Global Configuration (under the admin "System" menu). Click on the "server" tab. Then change the Gzip Page Compression parameter from "No" to "Yes".

Use Gzip to Speed Up WordPress, Drupal or Joomla

Drupal Gzip Activation

Activating Gzip on a Drupal-powered website requires modifying the .htaccess file. Simply add the following code to your .htaccess file (note: same code used for WordPress solution):

<IfModule mod_deflate.c>
# Compress HTML, CSS, JavaScript, Text, XML and fonts
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE font/opentype
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
# Remove browser bugs (only needed for really old browsers)
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent
</IfModule>

Verify Gzip Compression

Now it's time to check and make sure your website is outputting compressed pages. Use GzipTest.com to check if your site is being compressed. Note: testing your homepage will suffice.

As you can see, enabling Gzip compression on a WordPress, Joomla!, or Drupal website is a painless process. If you experience issues, it's likely that Gzip is either not installed or not configured correctly on your server. In such cases, contact the web hosting support team for assistance.

Is your website optimized? Show us a screenshot or send us a link to your Gzip test results. We love to celebrate website optimization.


About the author

Joe is a digital content creator and Founder of PraiseOn, a Christian lifestyle blog. His personal motto is "help those who help others." Among his peers, Joe's known as The Feedback Guy.