Skip to content

Instantly share code, notes, and snippets.

@EscApp2
Forked from Elvinz/.htaccess
Created October 25, 2023 08:21
Show Gist options
  • Save EscApp2/ae4d2521f940db82e7434acf5ed0c68a to your computer and use it in GitHub Desktop.
Save EscApp2/ae4d2521f940db82e7434acf5ed0c68a 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