How do I enable gzip on Dreamhost?
Asked Answered
U

3

5

I would like to compress all css and js on my Dreamhost site, I have found suggestions on the web but none of them work. Does anyone have a working example of gzip running on a Dreamhost site?

Unterwalden answered 14/12, 2009 at 21:22 Comment(0)
C
0

This thread on the Dreamhost support forum looks like it has the info you want.

Catalinacatalo answered 14/12, 2009 at 21:27 Comment(1)
The link wasn't completely correct, there's no .htaccess changes need (gzip is enabled by default apparently). So I just gzipped the files and removed the .gz extension from the files.Unterwalden
V
17

I'm a bit late to the game here in 2012, but I think this is still relevant. The "mod_gzip" method does not work in Dreamhost's .htaccess files any more. They seem to be using mod_deflate instead.

I removed the mod_gzip block and added the following to my .htaccess file:

AddOutputFilterByType DEFLATE text/html text/plain application/javascript text/css

This did the trick for me. You can also add other file types here in case you have things like XML or JSON - or something that falls outside the norm.

I've gone back and updated the Dreamhost wiki page to add this.

Virginia answered 29/3, 2012 at 23:34 Comment(1)
I also added image/svg+xml because Google PageSpeed insights was complaining about it.Estabrook
U
1

I haven't tried this yet. But, it might work

<IfModule mod_gzip.c>
  mod_gzip_on       Yes
  mod_gzip_dechunk  Yes
  mod_gzip_item_include file      \.(html?|txt|css|js|php|pl|jpg|png|gif)$
  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>

Source: http://wiki.dreamhost.com/Htaccess_tricks

Underproduction answered 26/3, 2012 at 4:38 Comment(0)
C
0

This thread on the Dreamhost support forum looks like it has the info you want.

Catalinacatalo answered 14/12, 2009 at 21:27 Comment(1)
The link wasn't completely correct, there's no .htaccess changes need (gzip is enabled by default apparently). So I just gzipped the files and removed the .gz extension from the files.Unterwalden

© 2022 - 2024 — McMap. All rights reserved.