+7 495 008 8452 пн.-пт. 10:00 – 17:00
Если у вас возникли какие либо вопросы которые вы не смогли решить по нашим публикациям самостоятельно,
то ждем ваше обращение в нашей службе тех поддержки.


Шпаргалка: Настройка 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>


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

Подписаться на новые материалы раздела:












CAPTCHA