Now in htaccess something like something like
EXPIRESDEFAULT “ACCESS PLUS 1 WEEK”
This solution has a clear disadvantage – if suddenly I want to update the style file, my update will reach users in a week. How to get around this without changing the term in Expires?
// I read about Last-modified, but I could not understand what. Please give as possible a detailed answer (or with reference to sources, any language)
We are talking only about caching on the client side.
Answer 1, Authority 100%
Example of caching settings Source (attempt number time Create almost perfect HTACCESS – & nbsp; habr) :
Addhandler Application / X-httpd-php .html
AddHandler CGI-script .pl .py .jsp .asp .htm .shtml .sh .cgi
ADDTYPE Application / X-JavaScript .js
AddType Text / CSS .css
AddType Text / XML .xml
AddType Application / OcTet-Stream .doc .mov .avi .pdf .xls
# Forcetype Application / X-Httpd-PHP
& lt; iFModule mod_deflate.c & gt;
AddoutPutFilterByType Deflate Text / Html Text / Plain Text / XML Application / XML Application / Xhtml + XML Text / CSS Text / JavaScript Application / JavaScript Application / X-JavaScript
& lt; / iFModule & gt;
& lt; iFModule mod_headers.c & gt;
# cache HTML and HTM files for one day
& lt; filesmatch "\. (HTML | HTM) $" & gt;
Header Set Cache-Control "Max-Age = 43200"
& lt; / filesmatch & gt;
# cache css, javascript and text files for one week
& lt; filesmatch "\. (JS | CSS | TXT) $" & gt;
Header Set Cache-Control "Max-Age = 604800"
& lt; / filesmatch & gt;
# cache flash and images for a month
& lt; FilesMatch "\. (FLV | SWF | ICO | GIF | jpg | jpeg | png) $" & gt;
Header Set Cache-Control "Max-Age = 2592000"
& lt; / filesmatch & gt;
# Disable caching
& lt; filesmatch "\. (PL | PHP | CGI | SPL | SCGI | FCGI) $" & gt;
Header Unset Cache-Control
& lt; / filesmatch & gt;
& lt; / iFModule & gt;
& lt; iFModule mod_expires.c & gt;
EXPIRESATIVE ON.
# default cache in 5 seconds
EXPIRESDEFAULT "ACCESS PLUS 5 SECONDS"
# cache flash and images for a month
EXPIRESBYTYPE Image / X-Icon "Access Plus 2592000 Seconds"
EXPIRESBYTYPE Image / JPEG "Access Plus 2592000 Seconds"
EXPIRESBYTYPE Image / PNG "Access Plus 2592000 Seconds"
EXPIRESBYTYPE IMAGE / GIF "Access Plus 2592000 Seconds"
EXPIRESBYTYPE Application / X-Shockwave-Flash "Access Plus 2592000 Seconds"
# cache css, javascript and text files for one week
EXPIRESBYTYPE TEXT / CSS "Access Plus 604800 Seconds"
EXPIRESBYTYPE TEXT / JAVASCRIPT "Access Plus 604800 Seconds"
EXPIRESBYTYPE Application / JavaScript "Access Plus 604800 Seconds"
EXPIRESBYTYPE Application / X-JavaScript "Access Plus 604800 Seconds"
# cache HTML and HTM files for one day
EXPIRESBYTYPE TEXT / HTML "Access Plus 43200 Seconds"
# cache xml files for ten minutes
EXPIRESBYTYPE Application / XHTML + XML "Access Plus 600 Seconds"
& lt; / iFModule & gt;
In order to reset the styles in HTML, it will be necessary to simply register the file version (GET parameter) and then the users have a new version, but you do not release a new style every hour.