Skip to content

Instantly share code, notes, and snippets.

@Elvinz
Forked from SergeyZaigraev/.htaccess
Created July 17, 2021 09:50
Show Gist options
  • Save Elvinz/a9ea5483e1471197dd5770cad2a95f96 to your computer and use it in GitHub Desktop.
Save Elvinz/a9ea5483e1471197dd5770cad2a95f96 to your computer and use it in GitHub Desktop.
Битрикс. Кэширование браузера. client cache
# Включаем кэш в браузерах посетителей
<ifModule mod_headers.c>
# Все html и htm файлы будут храниться в кэше браузера один день
<FilesMatch "\.(html|htm)$">
Header set Cache-Control "max-age=43200"
</FilesMatch>
# Все css, javascript и текстовые файлы будут храниться в кэше браузера одну неделю
<FilesMatch "\.(js|css|txt)$">
Header set Cache-Control "max-age=604800"
</FilesMatch>
# Все флэш файлы и изображения будут храниться в кэше браузера одну неделю
<FilesMatch "\.(flv|swf|ico|gif|jpg|jpeg|png)$">
Header set Cache-Control "max-age=604800"
</FilesMatch>
# Отключаем кеширование php и других служебных файлов
<FilesMatch "\.(pl|php|cgi|spl|scgi|fcgi)$">
Header unset Cache-Control
</FilesMatch>
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment