Я пытаюсь создать переписанный URL для CSS / JS с php minify. На tools.pingdom я получил это сообщение:
Следующие кэшируемые ресурсы имеют короткий срок действия свежести. Укажите срок действия не менее одной недели в будущем для следующих ресурсов:
Http: //www.xxx.xx/assets/minify/css-combined.css
Http: //www.xxx.xx/assets/minify/js-combined.js
В корне у меня есть .htaccess, содержащий истекает и правила заголовка:
<IfModule mod_expires.c>
ExpiresActive on
# Perhaps better to whitelist expires rules? Perhaps.
ExpiresDefault "access plus 1 month"# cache.appcache needs re-requests
# in FF 3.6 (thx Remy ~Introducing HTML5)
ExpiresByType text/cache-manifest "access plus 0 seconds"# Your document html
ExpiresByType text/html "access plus 1 month"# Data
ExpiresByType text/xml "access plus 0 seconds"ExpiresByType application/xml "access plus 0 seconds"ExpiresByType application/json "access plus 0 seconds"
# RSS feed
ExpiresByType application/rss+xml "access plus 1 hour"
# Favicon (cannot be renamed)
ExpiresByType image/x-icon "access plus 1 week"
# Media: images, video, audio
ExpiresByType image/gif "access plus 1 month"ExpiresByType image/png "access plus 1 month"ExpiresByType image/jpg "access plus 1 month"ExpiresByType image/jpeg "access plus 1 month"ExpiresByType video/ogg "access plus 1 month"ExpiresByType audio/ogg "access plus 1 month"ExpiresByType video/mp4 "access plus 1 month"ExpiresByType video/webm "access plus 1 month"
# HTC files (css3pie)
ExpiresByType text/x-component "access plus 1 month"
# Webfonts
ExpiresByType font/truetype "access plus 1 month"ExpiresByType font/opentype "access plus 1 month"ExpiresByType font/woff "access plus 1 month"ExpiresByType application/x-font-woff "access plus 1 month"ExpiresByType image/svg+xml "access plus 1 month"ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
# CSS and JavaScript
ExpiresByType text/css "access plus 1 year"ExpiresByType application/javascript "access plus 1 year"ExpiresByType text/javascript "access plus 1 year"
<IfModule mod_headers.c>
Header append Cache-Control "public"Header append Vary User-Agent
<FilesMatch "\.(js|css|xml|gz|woff)$">
Header append Vary: Accept-Encoding
</FilesMatch>
</IfModule>
в папке minify есть следующие правила .htaccess:
RewriteEngine on
RewriteRule ^(.*).js$ index.php?g=$1
RewriteRule ^(.*).css$ index.php?g=$1
Не могли бы вы мне помочь? Что я делаю неправильно?
Спасибо =)
С наилучшими пожеланиями,
Russianroot
закрытие IfModule может решить вашу проблему
<IfModule mod_expires.c>
я изменяю это для вас
<IfModule mod_expires.c>
ExpiresActive on
# Perhaps better to whitelist expires rules? Perhaps.
ExpiresDefault "access plus 1 month"# cache.appcache needs re-requests
# in FF 3.6 (thx Remy ~Introducing HTML5)
ExpiresByType text/cache-manifest "access plus 0 seconds"# Your document html
ExpiresByType text/html "access plus 1 month"# Data
ExpiresByType text/xml "access plus 0 seconds"ExpiresByType application/xml "access plus 0 seconds"ExpiresByType application/json "access plus 0 seconds"
# RSS feed
ExpiresByType application/rss+xml "access plus 1 hour"
# Favicon (cannot be renamed)
ExpiresByType image/x-icon "access plus 1 week"
# Media: images, video, audio
ExpiresByType image/gif "access plus 1 month"ExpiresByType image/png "access plus 1 month"ExpiresByType image/jpg "access plus 1 month"ExpiresByType image/jpeg "access plus 1 month"ExpiresByType video/ogg "access plus 1 month"ExpiresByType audio/ogg "access plus 1 month"ExpiresByType video/mp4 "access plus 1 month"ExpiresByType video/webm "access plus 1 month"
# HTC files (css3pie)
ExpiresByType text/x-component "access plus 1 month"
# Webfonts
ExpiresByType font/truetype "access plus 1 month"ExpiresByType font/opentype "access plus 1 month"ExpiresByType font/woff "access plus 1 month"ExpiresByType application/x-font-woff "access plus 1 month"ExpiresByType image/svg+xml "access plus 1 month"ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
# CSS and JavaScript
ExpiresByType text/css "access plus 1 year"ExpiresByType application/javascript "access plus 1 year"ExpiresByType text/javascript "access plus 1 year"</IfModule>
<IfModule mod_headers.c>
Header append Cache-Control "public"Header append Vary User-Agent
<FilesMatch "\.(js|css|xml|gz|woff)$">
Header append Vary: Accept-Encoding
</FilesMatch>
</IfModule>
Других решений пока нет …