@spaceseeker
Занимаюсь веб разработкой

Почему не работает ни один из методов кеширования?

Здравствуйте.
Инструмент гугла PageSpeed Insights показывает, что нужно включить кеширование файлов - developers.google.com/speed/pagespeed/insights/?ur...
Перепробовал все методы, найденные в сети, но показатели PageSpeed Insights не меняются - по прежнему пишет о необходимости включения кеша.
Не подскажите, чем может быть проблема?
#
#	. Имя файла: .htaccess
#	. Описание:
#
#		Файл конфигурации Apache.
#		Не редактируйте данный файл, не имея
#		чёткого представления о своих действиях
#		и их возможных последствиях.
#
#		Наличие файла и правильная его обработка
#		веб-сервером (включая модуль mod_rewrite)
#		обязательны для функционирования движка.
#
# ----------------------------------------------------------------------
# Gzip сжатие
# ----------------------------------------------------------------------
<IfModule mod_deflate.c>
  # Включаем deflate для не стандартных заголовков:
  # http://developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/
  <IfModule mod_setenvif.c>
    <IfModule mod_headers.c>
      SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
      RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
    </IfModule>
  </IfModule>
  <IfModule mod_filter.c>
    AddOutputFilterByType DEFLATE text/html text/plain text/css \
                                    application/json text/javascript application/javascript application/x-javascript text/x-js text/ecmascript application/ecmascript text/vbscript text/fluffscript \
                                    text/xml application/xml text/x-component \
                                    application/xhtml+xml application/rss+xml application/atom+xml \
                                    image/x-icon image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype
  </IfModule>
</IfModule>


# ----------------------------------------------------------------------
# Задаем Expires заголовки (срок актуальности файла) (для лучшего кэширования)
# ----------------------------------------------------------------------
# Указываются заголовки с большим сроком "годности",
# предполагается, что вы используете кэш на основе названий файлов (all.css?v001).
# В дополнение, учтите, что старые прокси могут кэшировать не верно
#   http://www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/

# Если вы не используете названия файлов для контроля версий, измените кэш для CSS и JS, например на
# "access plus 1 week".
<IfModule mod_expires.c>
  ExpiresActive on

# Задаем значение по умолчанию (для всех файлов)
  ExpiresDefault                          "access plus 1 month"

# cache.appcache нельзя кэшировать в FF 3.6 (спасибо Remy ~Introducing HTML5)
  ExpiresByType text/cache-manifest       "access plus 0 seconds"

# Ваш html документ
  <FilesMatch \.(html|xhtml|xml|shtml|phtml|php|txt)$>
    ExpiresDefault "access plus 0 seconds"
  </FilesMatch>
  ExpiresByType text/html                 "access plus 0 seconds"

# Данные
  ExpiresByType text/xml                  "access plus 0 seconds"
  ExpiresByType application/xml           "access plus 0 seconds"
  ExpiresByType application/json          "access plus 0 seconds"



Redirect 301 /index/ /
Redirect 301 /portfolio/yatenerife.com/ /portfolio/yatenerife/

RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

DirectoryIndex fidcms.php

RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . /fidcms.php [QSA]

# Раскомментируйте для дебага
 php_value error_reporting "E_ALL"
 php_flag display_errors off
 php_flag log_errors on

php_value output_buffering On
php_value default_charset utf-8
AddDefaultCharset UTF-8

FileETag MTime Size
<ifmodule mod_expires.c>
<filesmatch ".(jpg|jpeg|gif|png|ico|css|js)$">
ExpiresActive on
ExpiresDefault "access plus 1 year"
</filesmatch>
</ifmodule>
<IfModule mod_setenvif.c>
BrowserMatch "MSIE" force-no-vary
BrowserMatch "Mozilla/4.[0-9]{2}" force-no-vary
</IfModule>
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access 7 days"
ExpiresByType application/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>
<ifModule mod_headers.c>
<filesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$">
Header set Cache-Control "max-age=2592000, public"
</filesMatch>
<filesMatch "\.(css|js)$">
Header set Cache-Control "max-age=2592000, public"
</filesMatch>
<filesMatch "\.(xml|txt)$">
Header set Cache-Control "max-age=172800, public, must-revalidate"
</filesMatch>
<filesMatch "\.(html|htm|php)$">
Header set Cache-Control "max-age=172800, private, must-revalidate"
</filesMatch>
</ifModule>
  • Вопрос задан
  • 3310 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы