2016-12-12 5 views
-1

Я пытаюсь установить сжатие для css и js-файлов моего сайта.Не удается заставить сжатие моего сайта работать

Я попробовал множество настроек для моего файла .htaccess. Вот как это выглядит сейчас выглядит:

<IfModule mod_deflate.c> 
    # Compress HTML, CSS, JavaScript, Text, XML and fonts 
    AddOutputFilterByType DEFLATE application/javascript 
    AddOutputFilterByType DEFLATE application/rss+xml 
    AddOutputFilterByType DEFLATE application/vnd.ms-fontobject 
    AddOutputFilterByType DEFLATE application/x-font 
    AddOutputFilterByType DEFLATE application/x-font-opentype 
    AddOutputFilterByType DEFLATE application/x-font-otf 
    AddOutputFilterByType DEFLATE application/x-font-truetype 
    AddOutputFilterByType DEFLATE application/x-font-ttf 
    AddOutputFilterByType DEFLATE application/x-javascript 
    AddOutputFilterByType DEFLATE application/xhtml+xml 
    AddOutputFilterByType DEFLATE application/xml 
    AddOutputFilterByType DEFLATE font/opentype 
    AddOutputFilterByType DEFLATE font/otf 
    AddOutputFilterByType DEFLATE font/ttf 
    AddOutputFilterByType DEFLATE image/svg+xml 
    AddOutputFilterByType DEFLATE image/x-icon 
    AddOutputFilterByType DEFLATE text/css 
    AddOutputFilterByType DEFLATE text/html 
    AddOutputFilterByType DEFLATE text/javascript 
    AddOutputFilterByType DEFLATE text/plain 
    AddOutputFilterByType DEFLATE text/xml 

    # Remove browser bugs (only needed for really old browsers) 
    BrowserMatch ^Mozilla/4 gzip-only-text/html 
    BrowserMatch ^Mozilla/4\.0[678] no-gzip 
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html 
    Header append Vary User-Agent 
</IfModule> 

# BEGIN GZIP 
# mod_gzip compression (legacy, Apache 1.3) 
<IfModule mod_gzip.c> 
mod_gzip_on Yes 
mod_gzip_dechunk Yes 
mod_gzip_item_include file \.(html?|xml|txt|css|js)$ 
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> 
# END GZIP 

# DEFLATE compression 
<IfModule mod_deflate.c> 
# Set compression for: html,txt,xml,js,css 
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/javascript text/css application/x-javascript 
# Deactivate compression for buggy browsers 
BrowserMatch ^Mozilla/4 gzip-only-text/html 
BrowserMatch ^Mozilla/4.0[678] no-gzip 
BrowserMatch bMSIE !no-gzip !gzip-only-text/html 
# Set header information for proxies 
Header append Vary User-Agent 
</IfModule> 
# END DEFLATE 

Так, this site, говорит мне, что мой сайт 77,8% прессуют, но Google PageSpeed ​​insigth сказать это мне, что это не так. Так что я запутался здесь. Is my site спрессованный нет?

Спасибо!

+0

Зайдите в access.log, чтобы узнать, как Google обращается к вашему сайту. –

ответ

1

Если вы проверяете сетевые заголовки, первый запрос сжимается (http://www.dsisistemas.com.ar/), но другие файлы нет.

+0

Спасибо за ваш ответ. Ты прав! но я не знаю, что это значит. как я могу включить сжатие для других файлов? (CSS) – ericpap