Gzip compression using Apache server

Asked

Viewed 1,199 times

0

How to enable gzip compression in Apache? I took a look and saw that it is by htaccess, but every article I read passes a different instruction. Is there any material, article or thing like that that can give me a direction?

2 answers

2


Hello, I think this article may own what you are looking for:

How To Optimize Your Site With GZIP Compression

You should add in your htaccess the following code:

# comprimir texto, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript

# Ou, comprimir alguns tipos de arquivos pela extenção:
<files *.html>
SetOutputFilter DEFLATE
</files>

It was the most didactic I found on the subject, I hope it will be useful.

  • If it doesn’t work properly let me know, thank you.

1

AddOutputFilterByType DEFLATE text/html

AddOutputFilterByType DEFLATE text/plain

AddOutputFilterByType DEFLATE text/xml

AddOutputFilterByType DEFLATE text/css

AddOutputFilterByType DEFLATE application/javascript

There is a great reference for this feature and other optimizations in the links below:

Browser other questions tagged

You are not signed in. Login or sign up in order to post.