10139N/A<!
DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
10139N/A <
TITLE>Apache module mod_expires</
TITLE>
10139N/A<!-- Background white, links blue (unvisited), navy (visited), red (active) --> 10139N/A <
H1 ALIGN="CENTER">Module mod_expires</
H1>
10139N/A is <
STRONG>not</
STRONG> compiled in by default. It provides for the
11838N/A generation of <
CODE>Expires</
CODE> headers according to user-specified
11195N/A This module controls the setting of the <
CODE>Expires</
CODE> HTTP
10529N/A header in server responses. The expiration date can set to be
11195N/A relative to either the time the source file was last modified, or to
11195N/A The <
CODE>Expires</
CODE> HTTP header is an instruction to the client
10139N/A about the document's validity and persistence. If cached, the document
11195N/A may be fetched from the cache rather than from the source until this
10139N/A time has passed. After that, the cache copy is considered
11195N/A "expired" and invalid, and a new copy must be obtained from
10139N/A <!--%plaintext <?INDEX {\tt ExpiresActive} directive> --> 10139N/A ><
STRONG>Syntax:</
STRONG></
A> ExpiresActive <
EM>boolean</
EM>
10139N/A ><
STRONG>Context:</
STRONG></
A> server config, virtual host, directory,
10139N/A ><
STRONG>Override:</
STRONG></
A> Indexes
10139N/A ><
STRONG>Status:</
STRONG></
A> Extension
10139N/A ><
STRONG>Module:</
STRONG></
A> mod_expires
10139N/A This directive enables or disables the generation of the
10139N/A <
CODE>Expires</
CODE> header for the document realm in question. (That
10139N/A is, if found in an <
CODE>.htaccess</
CODE> file, for instance, it
10139N/A applies only to documents generated from that directory.) If set to
10139N/A <
EM><
CODE>Off</
CODE></
EM>, no <
CODE>Expires</
CODE> header will be
10139N/A generated for any document in the realm (unless overridden at a lower
10139N/A level, such as an <
CODE>.htaccess</
CODE> file overriding a server
10139N/A config file). If set to <
EM><
CODE>On</
CODE></
EM>, the header will be
10139N/A added to served documents according to the criteria defined by the
11195N/A Note that this directive does not guarantee that an
10139N/A <
CODE>Expires</
CODE> header will be generated. If the criteria aren't
11195N/A met, no header will be sent, and the effect will be as though this
10139N/A directive wasn't even specified.
10139N/A <!--%plaintext <?INDEX {\tt ExpiresByType} directive> --> 10139N/A ><
STRONG>Syntax:</
STRONG></
A> ExpiresByType <
EM>mime-type
10139N/A ><
STRONG>Context:</
STRONG></
A> server config, virtual host, directory,
10139N/A ><
STRONG>Override:</
STRONG></
A> Indexes
10139N/A ><
STRONG>Status:</
STRONG></
A> Extension
10139N/A ><
STRONG>Module:</
STRONG></
A> mod_expires
10139N/A This directive defines the value of the <
CODE>Expires</
CODE> header
11271N/A generated for documents of the specified type (<
EM>
e.g.</
EM>,
10139N/A seconds that will be added to a base time to construct the expiration
10139N/A The base time is either the last modification time of the file, or the
10139N/A time of the client's access to the document. Which should be used is
10139N/A specified by the <
CODE><
EM><code></
EM></
CODE> field;
10139N/A <
STRONG>M</
STRONG> means that the file's last modification time should
10139N/A be used as the base time, and <
STRONG>A</
STRONG> means the client's
10139N/A The difference in effect is subtle. If <
EM>M</
EM> is used, all current
10139N/A copies of the document in all caches will expire at the same time,
10139N/A which can be good for something like a weekly notice that's always
10139N/A found at the same URL. If <
EM>A</
EM> is used, the date of expiration
10139N/A is different for each client; this can be good for image files that
10139N/A don't change very often, particularly for a set of related documents
10139N/A that all refer to the same images (<
EM>
i.e.</
EM>, the images will be
10139N/A accessed repeatedly within a relatively short timespan).
10139N/A ExpiresActive On # enable expirations
10139N/A Note that this directive only has effect if <
CODE>ExpiresActive
10139N/A On</
CODE> has been specified. It overrides, for the specified MIME
10139N/A type <
EM>only</
EM>, any expiration date set by the
10139N/A You can also specify the expiration time calculation using an
10139N/A described later in this document.
10139N/A <!--%plaintext <?INDEX {\tt ExpiresDefault} directive> --> 10139N/A ><
STRONG>Syntax:</
STRONG></
A> ExpiresDefault <
EM><code>seconds</
EM>
10139N/A ><
STRONG>Context:</
STRONG></
A> server config, virtual host, directory,
10139N/A ><
STRONG>Override:</
STRONG></
A> Indexes
12091N/A ><
STRONG>Status:</
STRONG></
A> Extension
11922N/A ><
STRONG>Module:</
STRONG></
A> mod_expires
11416N/A This directive sets the default algorithm for calculating the
11416N/A expiration time for all documents in the affected realm. It can be
11352N/A overridden on a type-by-type basis by the
11271N/A directive. See the description of that directive for details about
11271N/A the syntax of the argument, and the
11271N/A <
A NAME="AltSyn">Alternate Interval Syntax</
A>
11017N/A ><
SAMP>ExpiresDefault</
SAMP></
A>
10529N/A ><
SAMP>ExpiresByType</
SAMP></
A>
10454N/A directives can also be defined in a more readable syntax of the form:
10281N/A <
DD><
CODE>ExpiresDefault "<base> [plus] {<num> <type>}*"
10139N/A {<num> <type>}*"</
CODE>
10139N/A <
LI><
SAMP>now</
SAMP> (equivalent to '<
SAMP>access</
SAMP>')
10139N/A The '<
SAMP>plus</
SAMP>' keyword is optional. <num> should be an
10139N/A integer value [acceptable to <
SAMP>atoi()</
SAMP>], and <type>
10139N/A For example, any of the following directives can be used to make
10139N/A documents expire 1 month after being accessed, by default:
10139N/A <
DD><
CODE>ExpiresDefault "access plus 1 month"
10139N/A ExpiresDefault "access plus 4 weeks"
10139N/A ExpiresDefault "access plus 30 days"</
CODE>
10139N/A The expiry time can be fine-tuned by adding several '<num>
10139N/A <
DD><
CODE>ExpiresByType
text/
html "access plus 1 month 15 days 2 hours"