Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I must assume that this is a duplicate question, but I could not find the answer myself. I want to enable gzip compression to everything my website sends (mostly php, css, a slight bit of js).

this question makes a point of adding a line into the .htaccess file (that i do have access to) but i'm not sure if that would include the dynamic content.

this question (has a typo in the question, it should be ob_start I think) tells me how to enable gzip to php files. and after fixing the typo it seems to work.

do i need to use both ? is there anything else i need as well ?

share|improve this question
up vote 2 down vote accepted

The output of PHP files is HTML. That HTML will be compressed using the code in this question:

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

That's all you need to do (assuming mod_deflate is enabled for Apache).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.