How to enable gzip compression in Apache? I took a look and saw that it is htaccess
, but every article I read passes a different statement. Is there any material, article or thing of the kind that can give me a direction?
How to enable gzip compression in Apache? I took a look and saw that it is htaccess
, but every article I read passes a different statement. Is there any material, article or thing of the kind that can give me a direction?
Hello, I think this article may have what you're looking for:
How To Optimize Your Site With GZIP Compression
You should add the following code to your htaccess:
# 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 is useful.
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: