Enabling data compression using the mod_deflate module
The mod_deflate module in Apache allows you to compress output before sending it to client browsers. On ruachost.com, enabling compression reduces page load times and bandwidth usage, improving overall site performance.
Why Use mod_deflate?
Section titled “Why Use mod_deflate?”- Speeds up website loading by reducing file sizes.
- Saves bandwidth costs.
- Improves SEO rankings (Google favors faster sites).
- Works seamlessly with most modern browsers.
Steps to Enable Compression
Section titled “Steps to Enable Compression”Managed Hosting Accounts (cPanel)
Section titled “Managed Hosting Accounts (cPanel)”-
Log in to cPanel.
-
Go to Software → Optimize Website.
-
Under Compress Content, choose one of the following:
- Compress All Content – compresses everything.
- Compress Specified MIME Types – compresses only certain file types.
-
Click Update Settings.
-
Test compression using tools like GiftOfSpeed Gzip Test.
Unmanaged Hosting Accounts
Section titled “Unmanaged Hosting Accounts”Edit your .htaccess file to enable compression.
Option 1: By File Extension
Section titled “Option 1: By File Extension”<IfModule mod_deflate.c> <FilesMatch "\.(js|css|html|php)$"> SetOutputFilter DEFLATE </FilesMatch></IfModule>Option 2: By MIME Type
Section titled “Option 2: By MIME Type”<IfModule mod_deflate.c> AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript</IfModule>- This compresses HTML, CSS, JavaScript, XML, and plain text files.
- To disable compression, comment out or remove the relevant lines.
Verifying Compression
Section titled “Verifying Compression”- Visit GiftOfSpeed Gzip Test.
- Enter your domain name.
- The tool will confirm whether compression is active.