NeoXidizer
BANNED | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору Настроил сжатие файлов через .htaccess (Apache 2.2, windows), сжимается все, кроме javascript FireBug показывает размер style.css 17.21KB, после сжатия 4.14KB, так же сжимается основная страница text/html с 13.13KB до 3.09KB - тобишь все работает Но информация по javascript показывает, что размер не меняется, например как был jQuery.js 83.71KB, так и остался. Рядом со скриптами имеются .gz архивы (style.css таковой тоже имеет, и этот архив передается) HTTP ответ для style.css: Цитата: Response Headers Accept-Ranges:bytes Cache-Control:max-age=31536000, public, must-revalidate Connection:Keep-Alive Content-Encoding:gzip Content-Length:4241 Content-Type:text/css Date:Mon, 04 Apr 2011 17:28:48 GMT Expires:Sun, 15 May 2011 19:54:37 GMT Keep-Alive:timeout=5, max=99 Last-Modified:Sun, 03 Apr 2011 19:54:37 GMT Server:Apache/2.2.17 (Win32) PHP/5.3.5 Vary:Accept-Encoding,User-Agent | для jQuery.js: Цитата: Response Headers Accept-Ranges:bytes Cache-Control:max-age=31536000, public, must-revalidate Connection:Keep-Alive Content-Length:85716 Content-Type:application/javascript Date:Mon, 04 Apr 2011 17:28:48 GMT Expires:Tue, 03 Apr 2012 17:28:48 GMT Keep-Alive:timeout=5, max=100 Last-Modified:Sun, 03 Apr 2011 19:30:40 GMT Server:Apache/2.2.17 (Win32) PHP/5.3.5 Vary:User-Agent,Accept-Encoding | сам htaccess: Код: ### BEGIN .htaccess # Protect the htaccess file <Files .htaccess> Order Allow,Deny Deny from all </Files> # Protect wpconfig.php <Files wp-config.php> Order Allow,Deny Deny from all </Files> # Disable directory browsing Options All -Indexes # BEGIN COMPRESSION AND CACHING <IfModule mod_deflate.c> # Enable compression AddOutputFilterByType DEFLATE text/css text/javascript application/x-javascript text/html text/plain text/xml image/x-icon <IfModule mod_setenvif.c> BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4\.0[678] no-gzip BrowserMatch \bMSIE !no-gzip !gzip-only-text/html BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html </IfModule> <IfModule mod_headers.c> # Make sure proxies deliver correct content Header append Vary User-Agent env=!dont-vary # Ensure proxies deliver compressed content correctly Header append Vary Accept-Encoding </IfModule> </IfModule> <IfModule mod_headers.c> # No ETags, No Pragma Header unset Pragma Header unset ETag # Default cache time to 1 year (31536000 sec) Header set Cache-Control "max-age=31536000, public, must-revalidate" </IfModule> # No ETags FileETag none # CACHE SETTINGS (mod_expires) <IfModule mod_expires.c> # Turn on Expires ExpiresActive On # set default to "access plus 1 year" ExpiresDefault A31536000 # html - "modification plus 1 hour" ExpiresByType text/html M3600 # css and JavaScript - "modification plus 6 weeks" ExpiresByType text/css M3628800 ExpiresByType text/javascript M3628800 ExpiresByType application/x-javascript M3628800 </IfModule> # No cache for php-files <FilesMatch "\.(php)$"> <IfModule mod_expires.c> ExpiresActive Off </IfModule> <IfModule mod_headers.c> Header set Cache-Control "private, no-cache, no-store, proxy-revalidate, no-transform" </IfModule> </FilesMatch> # END CACHING # W3 Total Cache are here (automatically included by the plugin): # WordPress Default Rules are here (at the end of the file): # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress ### END .htaccess | однако, есть еще такой вариант: Код: AddEncoding gzip .gz RewriteEngine On ### Отдаём *.gz вместо файла , если *.gz присутствует в той же директории, RewriteCond %{HTTP:Accept-encoding} gzip RewriteCond %{HTTP_USER_AGENT} !Safari RewriteCond %{REQUEST_FILENAME}.gz -f RewriteRule ^(.*)$ $1.gz [QSA,L] | и он работает... так же отлично работает Код: <FilesMatch "\\.(js|css|html|htm|php|xml)$"> SetOutputFilter DEFLATE </FilesMatch> | как сделать лучше? эффективней? |