Created
October 4, 2016 21:25
Принудительное перенаправление на загрузки gzip архивов. Добавляем этот код в .htaccess и "ручками" архивируем необходимые для сжатия файлы и кладем их в ту же дерикторию
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteEngine on | |
RewriteCond %{HTTP:Accept-encoding} gzip | |
RewriteCond %{REQUEST_FILENAME}\.gz -s | |
RewriteRule ^(.*)\.css $1\.css\.gz [QSA] | |
RewriteCond %{HTTP:Accept-encoding} gzip | |
RewriteCond %{REQUEST_FILENAME}\.gz -s | |
RewriteRule ^(.*)\.js $1\.js\.gz [QSA] | |
<FilesMatch .*\.js\.gz$> | |
ForceType text/javascript | |
Header set Content-Encoding gzip | |
Header append Vary Accept-Encoding | |
</FilesMatch> | |
<FilesMatch .*\.css\.gz$> | |
ForceType text/css | |
Header set Content-Encoding gzip | |
Header append Vary Accept-Encoding | |
</FilesMatch> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment