Сжатие + кеш браузера

KB
На сайте с 06.06.2014
Offline
38
1964

Подскажите как включить сжатие и использовать кеш браузера.

на всех сайтах в .htaccess прописал:

# кеширование в браузере на стороне пользователя

<IfModule mod_expires.c>

ExpiresActive On

ExpiresDefault "access 7 days"

ExpiresByType application/javascript "access plus 1 year"

ExpiresByType application/x-javascript "access plus 1 year"

ExpiresByType text/javascript "access plus 1 year"

ExpiresByType text/css "access plus 1 year"

ExpiresByType text/html "access plus 7 day"

ExpiresByType text/x-javascript "access 1 year"

ExpiresByType image/gif "access plus 1 year"

ExpiresByType image/jpeg "access plus 1 year"

ExpiresByType image/png "access plus 1 year"

ExpiresByType image/jpg "access plus 1 year"

ExpiresByType image/x-icon "access 1 year"

ExpiresByType application/x-shockwave-flash "access 1 year"

</IfModule>

# Cache-Control

<ifModule mod_headers.c>

# 30 дней

<filesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$">

Header set Cache-Control "max-age=2592000, public"

</filesMatch>

# 30 дней

<filesMatch "\.(css|js)$">

Header set Cache-Control "max-age=2592000, public"

</filesMatch>

# 2 дня

<filesMatch "\.(xml|txt)$">

Header set Cache-Control "max-age=172800, public, must-revalidate"

</filesMatch>

# 1 день

<filesMatch "\.(html|htm|php)$">

Header set Cache-Control "max-age=172800, private, must-revalidate"

</filesMatch>

</ifModule>

# использование кеша браузеров

FileETag MTime Size

<ifmodule mod_expires.c>

<filesmatch ".(jpg|jpeg|gif|png|ico|css|js)$">

ExpiresActive on

ExpiresDefault "access plus 1 year"

</filesmatch>

</ifmodule>

#Запрет отдачи HTTP-заголовков Vary браузерам семейства MSIE

<IfModule mod_setenvif.c>

BrowserMatch "MSIE" force-no-vary

BrowserMatch "Mozilla/4.[0-9]{2}" force-no-vary

</IfModule>

<ifModule mod_deflate.c>

AddOutputFilterByType DEFLATE text/html

AddOutputFilterByType DEFLATE application/javascript

AddOutputFilterByType DEFLATE text/javascript

AddOutputFilterByType DEFLATE text/css

<ifModule mod_setenvif.c>

BrowserMatch ^Mozilla/4 gzip-only-text/html

BrowserMatch ^Mozilla/4.0[678] no-gzip

BrowserMatch bMSIE !no-gzip !gzip-only-text/html

</ifModule>

</ifModule>

PageSpeed Insights все равно пишет включить сжатие и использовать кеш браузера...

хотя такие сервисы показывают что сжатие происходит:

http://www.whatsmyip.org/http-compression-test/

http://checkgzipcompression.com/

seocore
На сайте с 25.09.2006
Offline
143
#1
KostyanBr:
Подскажите как включить сжатие и использовать кеш браузера.
на всех сайтах в .htaccess прописал

если стоит nginx на раздаче статики, то сжатие и браузерное кеширование надо включать в его конфиге, а не в .htaccess'е

Инструменты для веб-мастера: кластеризатор СЯ (https://goo.gl/MQWfqO), все запросы конкурента (https://goo.gl/hd5uHS), дешевые XML-лимиты (https://goo.gl/aDZbPI)

Авторизуйтесь или зарегистрируйтесь, чтобы оставить комментарий