Apache - mod deflate - включаем gzip сжатие через .htaccess

Материал из Wiki - Iphoster - the best ever hosting and support. 2005 - 2023
Перейти к:навигация, поиск
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Apache - mod deflate - включаем gzip сжатие через .htaccess

Проверяем или включен сам модуль для Apache:

# httpd -M | grep deflate
 deflate_module (shared)


Добавить в .htaccess файл:

<ifModule mod_deflate.c>
 <IfModule mod_filter.c>
     AddOutputFilterByType DEFLATE text/plain text/html
     AddOutputFilterByType DEFLATE text/css
     AddOutputFilterByType DEFLATE text/javascript application/javascript application/x-javascript
     AddOutputFilterByType DEFLATE text/xml application/xml application/xhtml+xml application/rss+xml
     AddOutputFilterByType DEFLATE application/json
     AddOutputFilterByType DEFLATE application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml image/x-icon
 </ifModule>
</ifModule>