Enable gzip compression on Bluehost?
Solution 1
An update to this question, I recently spoke to BlueHost who told me the following:
The way gzip works is that when certain criteria are reached with the server resources, gzip will be enabled and start compressing the sites as needed. Even with the code in the .htaccess file, that's not actually something that you will be able to configure on the account.
But from my findings "as needed" translated to "never". If you really want to GZIP you content (and deliver it quickly) I suggest you look at using Cloudflare as a CDN. Bluehost are a hosting partner of theirs, so it's trivial to set up.
Solution 2
I use the following in the .htaccess on my bluehost account (as recommended by a friend)
<Files ~ "^[^\.]+$">
ForceType application/x-httpd-php
SetOutputFilter DEFLATE
</Files>
<FilesMatch "\.(js|css|html|htm|php|xml)$">
SetOutputFilter DEFLATE
</FilesMatch>
ExpiresActive on
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType text/css "access plus 1 month"
AddType image/vnd.microsoft.icon .ico
ExpiresByType image/vnd.microsoft.icon "access plus 3 months"
Related videos on Youtube
Comments
-
lanan over 1 year
My website is loading large (~3mb) SVG file with jQuery. It takes quite a while therefore I decided to enable gzip compression. I have a hosting account with Bluehost which supports custom .htaccess files. Here is what I have tried to add to .htaccess file to enable compression without any success (I used Google's Page Speed for testing):
<IfModule mod_php5.c> php_value output_buffering "1" php_value output_handler ob_gzhandler </IfModule> <IfModule mod_deflate.c> AddOutputFilterByType DEFLATE text/html text/xml text/plain text/css text/javascript application/x-javascript </IfModule> <IfModule mod_gzip.c> mod_gzip_on Yes mod_gzip_dechunk Yes mod_gzip_item_include file \.(html?|txt|xml|css|js|php|pl|gif|jpg|jpeg|png|swf)$ mod_gzip_item_include handler ^cgi-script$ mod_gzip_item_include mime ^text/.* mod_gzip_item_include mime ^application/x-javascript.* mod_gzip_item_exclude mime ^image/.* mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.* </IfModule>
-
Jonx over 12 yearsIn its present form this question is too localized (see Pro Webmasters FAQ). You need to check the installed Apache modules and contact your host for assistance if the modules you need are not installed or not performing as you expect.
-
lanan over 12 yearsSorry I didn't realized that the question can be too specific. I wanted to try to ask this question here because I already know what type of an answer ill get from tech support (they probably will say that modules are not available for me to configure). So I thought maybe some people here came up with workarounds or suggestions they could kindly share.
-
lanan over 12 yearsBut I am gonna follow your advise and contact tech support.
-
-
lanan over 12 yearsHey thanks for your answer! Unfortunately it didn't work for me all of my .xml .js and .css files are still sent without any compression (i added your code to my .htaccess file in public_html). I guess mod_deflate is not always available on Bluehost. Im trying to contact them to find out the answer.