Добавьте в ваш файл .htaccess следующий код:

  ExpiresActive on
FileETag MTime Size
# Задаем значение по умолчанию (для всех файлов)
  ExpiresDefault                          "access plus 1 month"
# Ваш html документ
  
    ExpiresDefault "access plus 0 seconds"
  
  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"
# Рассылка
  ExpiresByType application/rss+xml       "access plus 1 hour"
  ExpiresByType application/atom+xml      "access plus 1 hour"
# Favicon (не может быть переименован)
  
    ExpiresDefault "access plus 1 week"
  
  ExpiresByType image/x-icon              "access plus 1 week"
# Медиа: изображения, видео, аудио
  
    ExpiresDefault "access plus 1 year"
  
  ExpiresByType image/gif                 "access plus 1 month"
  ExpiresByType image/png                 "access plus 1 month"
  ExpiresByType image/jpeg                "access plus 1 month"
  ExpiresByType video/ogg                 "access plus 1 month"
  ExpiresByType audio/ogg                 "access plus 1 month"
  ExpiresByType video/mp4                 "access plus 1 month"
  ExpiresByType video/webm                "access plus 1 month"
# Веб-шрифты
  
    ExpiresDefault "access plus 1 year"
  
  ExpiresByType application/x-font-ttf    "access plus 1 month"
  ExpiresByType font/opentype             "access plus 1 month"
  ExpiresByType application/x-font-woff   "access plus 1 month"
  ExpiresByType image/svg+xml             "access plus 1 month"
  ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
# CSS и JavaScript
  
    ExpiresDefault "access plus 1 year"
  
  ExpiresByType text/css                  "access plus 1 year"
  ExpiresByType application/javascript    "access plus 1 year"
# Статичные ресурсы
  
    ExpiresDefault "access plus 1 year"
  
  ExpiresByType application/x-shockwave-flash "access plus 1 year"
  ExpiresByType application/pdf               "access plus 1 year"
  ExpiresByType application/msword            "access plus 1 year"
  ExpiresByType application/rtf               "access plus 1 year"
  ExpiresByType application/vnd.ms-excel      "access plus 1 year"
  ExpiresByType application/vnd.ms-powerpoint "access plus 1 year"

Помог ли вам данный ответ? 0 Пользователи нашли это полезным (3 голосов)