+7 495 008 8452
  • Загрузка
Выберите ваш цвет
Если у вас возникли какие либо вопросы которые вы не смогли решить по нашим публикациям самостоятельно,
то ждем ваше обращение в нашей службе тех поддержки.


Шпаргалка: Настройка mod_expires.c

В двух словах, настройка модуля позволяет установить кеширование статики браузером.
Настройки от Битрикс по умолчанию довольно скудны (в .htaccess):
<IfModule mod_expires.c>
   ExpiresActive on
   ExpiresByType image/jpeg "access plus 3 day"
   ExpiresByType image/gif "access plus 3 day"
</IfModule>


Этого явно мало. Поэтому я предлагаю такой вариант:
<IfModule mod_headers.c>
    Header unset ETag
</IfModule>
 
<IfModule mod_expires.c>

    ExpiresActive on
    ExpiresDefault                                      "access plus 1 week"

  # CSS
    ExpiresByType text/css                              "access plus 1 week"

  # Data interchange
    ExpiresByType application/json                      "access plus 0 seconds"
    ExpiresByType application/ld+json                   "access plus 0 seconds"
    ExpiresByType application/vnd.geo+json              "access plus 0 seconds"
    ExpiresByType application/xml                       "access plus 0 seconds"
    ExpiresByType text/xml                              "access plus 0 seconds"

  # Favicon (cannot be renamed!) and cursor images
    ExpiresByType image/x-icon                          "access plus 1 week"

  # HTML components (HTCs)
    ExpiresByType text/x-component                      "access plus 1 week"

  # HTML
    ExpiresByType text/html                             "access plus 0 seconds"

  # JavaScript
    ExpiresByType application/javascript                "access plus 1 week"

  # Manifest files
    ExpiresByType application/manifest+json             "access plus 1 week"
    ExpiresByType application/x-web-app-manifest+json   "access plus 0 seconds"
    ExpiresByType text/cache-manifest                   "access plus 0 seconds"

  # Media
    ExpiresByType audio/ogg                             "access plus 1 week"
    ExpiresByType image/gif                             "access plus 1 week"
    ExpiresByType image/jpeg                            "access plus 1 week"
    ExpiresByType image/png                             "access plus 1 week"
    ExpiresByType video/mp4                             "access plus 1 week"
    ExpiresByType video/ogg                             "access plus 1 week"
    ExpiresByType video/webm                            "access plus 1 week"

  # Web feeds
    ExpiresByType application/atom+xml                  "access plus 1 hour"
    ExpiresByType application/rss+xml                   "access plus 1 hour"

  # Web fonts
    ExpiresByType application/font-woff                 "access plus 1 week"
    ExpiresByType application/vnd.ms-fontobject         "access plus 1 week"
    ExpiresByType application/x-font-ttf                "access plus 1 week"
    ExpiresByType font/opentype                         "access plus 1 week"
    ExpiresByType image/svg+xml                         "access plus 1 week"

</IfModule>

 

 

Источник: http://dev.1c-bitrix.ru/community/webdev/user/94272/blog/10847/

Назад в раздел

Подписаться на новые материалы раздела:
Загрузка...