Вопросы оптимизации сайта для поисковых систем. Вывод сайтов на первые позиции по ключевым словам
https://gtmetrix.com/ и сервис, которорому уже лет наверное 20 ... http://www.webpagetest.org/
https://www.keycdn.com/support/remove-query-strings-from-static-resources
I don't recommend compressig gzip files on the fly (neither with a joomla plugin like JCH or with an Apache module). Both will consume CPU. A much better solution is to have your files already compressed in gzip, but also have them in js/css format. Then, instruct the Apache server via htaccess that when a browser supports gzip, it should serve the gzip version, when the browser doesnt support gzip, serve them the raw/uncompressed version. For this, you only have to add these lines at the end of your .htaccess:
#Serve gzip compressed CSS files if they exist and the client accepts gzip.
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{REQUEST_FILENAME}\.gz -s
RewriteRule ^(.*)\.css $1\.css\.gz [QSA]
# Serve gzip compressed JS files if they exist and the client accepts gzip.
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{REQUEST_FILENAME}\.gz -s
RewriteRule ^(.*)\.js $1\.js\.gz [QSA]
# Serve correct content types, and prevent mod_deflate double gzip.
RewriteRule \.css\.gz$ - [T=text/css,E=no-gzip:1] RewriteRule \.js\.gz$ - [T=text/javascript,E=no-gzip:1]
<FilesMatch ".gz$">
Header set Content-Encoding "gzip"
Header append Vary: Accept-Encoding
</FilesMatch>
I agree it's much better to pre gzip static assets ahead of time then just serve them out. This is what I use:
ReWriteCond %{HTTP:accept-encoding} gzip
RewriteCond %{REQUEST_URI} \.(?:js|css|html?|txt)$ [NC]
RewriteCond %{REQUEST_FILENAME}.gz -f
RewriteRule ^(.*\.(?:js|css|html?|txt))$ $1.gz [L]
Проект Joom-la-la предназначен для начинающих пользователей Системы управления сайтами Joomla; программистов, администраторов. Мы хотим поделиться с вами своими наработками и примерами.
Это один из сотен сайтов, сделанных нами в рамках бренда Petrovich Group. Надеемся быть вам полезными и ждём ваших комментариев