mirror of
https://github.com/apache/httpd.git
synced 2025-05-19 02:21:09 +03:00
This is the end of this pass for the online manual. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@78228 13f79535-47bb-0310-9956-ffa450edef68
186 lines
6.1 KiB
HTML
186 lines
6.1 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<TITLE>Apache module mod_expires</TITLE>
|
|
</HEAD>
|
|
<!-- Background white, links blue (unvisited), navy (visited), red (active) -->
|
|
<BODY
|
|
BGCOLOR="#FFFFFF"
|
|
TEXT="#000000"
|
|
LINK="#0000FF"
|
|
VLINK="#000080"
|
|
ALINK="#FF0000"
|
|
>
|
|
<!--#include virtual="header.html" -->
|
|
<H1 ALIGN="CENTER">Module mod_expires</H1>
|
|
<P>
|
|
This module is contained in the <CODE>mod_expires.c</CODE> file, and
|
|
is <STRONG>not</STRONG> compiled in by default. It provides for the
|
|
generation of <CODE>Expires</CODE> headers according to user-specified
|
|
criteria.
|
|
</P>
|
|
<H2>Summary</H2>
|
|
<P>
|
|
This module controls the setting of the <CODE>Expires</CODE> HTTP
|
|
header in server responses. The expiration date can set to be
|
|
relative to either the time the source file was last modified, or to
|
|
the time of the client access.
|
|
</P>
|
|
<P>
|
|
The <CODE>Expires</CODE> HTTP header is an instruction to the client
|
|
about the document's validity and persistence. If cached, the document
|
|
may be fetched from the cache rather than from the source until this
|
|
time has passed. After that, the cache copy is considered
|
|
"expired" and invalid, and a new copy must be obtained from
|
|
the source.
|
|
</P>
|
|
<H2>Directives</H2>
|
|
<P>
|
|
<MENU>
|
|
<LI><A
|
|
HREF="#expiresactive"
|
|
>ExpiresActive</A>
|
|
</LI>
|
|
<LI><A
|
|
HREF="#expiresbytype"
|
|
>ExpiresByType</A>
|
|
</LI>
|
|
<LI><A
|
|
HREF="#expiresdefault"
|
|
>ExpiresDefault</A>
|
|
</LI>
|
|
</MENU>
|
|
<HR>
|
|
<H2><A NAME="expiresactive">
|
|
ExpiresActive directive
|
|
</A></H2>
|
|
<!--%plaintext <?INDEX {\tt ExpiresActive} directive> -->
|
|
<P>
|
|
<STRONG>Syntax:</STRONG> ExpiresActive <EM>boolean</EM>
|
|
<BR>
|
|
<STRONG>Context:</STRONG> server config, virtual host, directory, .htaccess
|
|
<br>
|
|
<STRONG>Override:</STRONG> Indexes
|
|
<br>
|
|
<STRONG>Status:</STRONG> Extension
|
|
<br>
|
|
<STRONG>Module:</STRONG> mod_expires
|
|
</P>
|
|
<P>
|
|
This directive enables or disables the generation of the
|
|
<CODE>Expires</CODE> header for the document realm in question. (That
|
|
is, if found in an <CODE>.htaccess</CODE> file, for instance, it
|
|
applies only to documents generated from that directory.) If set to
|
|
<EM><CODE>Off</CODE></EM>, no <CODE>Expires</CODE> header will be
|
|
generated for any document in the realm (unless overridden at a lower
|
|
level, such as an <CODE>.htaccess</CODE> file overriding a server
|
|
config file). If set to <EM><CODE>On</CODE></EM>, the header will be
|
|
added to served documents according to the criteria defined by the
|
|
<A
|
|
HREF="#expiresbytype"
|
|
>ExpiresByType</A>
|
|
and
|
|
<A
|
|
HREF="#expiresdefault"
|
|
>ExpiresDefault</A>
|
|
directives (<EM>q.v.</EM>).
|
|
</P>
|
|
<P>
|
|
Note that this directive does not guarantee that an
|
|
<CODE>Expires</CODE> header will be generated. If the criteria aren't
|
|
met, no header will be sent, and the effect will be as though this
|
|
directive wasn't even specified.
|
|
</P>
|
|
<HR>
|
|
<H2><A NAME="expiresbytype">
|
|
ExpiresByType directive
|
|
</A></H2>
|
|
<!--%plaintext <?INDEX {\tt ExpiresByType} directive> -->
|
|
<P>
|
|
<STRONG>Syntax:</STRONG> ExpiresByType <EM>mime-type <code>seconds</EM>
|
|
<BR>
|
|
<STRONG>Context:</STRONG> server config, virtual host, directory, .htaccess
|
|
<br>
|
|
<STRONG>Override:</STRONG> Indexes
|
|
<br>
|
|
<STRONG>Status:</STRONG> Extension
|
|
<br>
|
|
<STRONG>Module:</STRONG> mod_expires
|
|
</P>
|
|
<P>
|
|
This directive defines the value of the <CODE>Expires</CODE> header
|
|
generated for documents of the specified type (<EM>e.g.</EM>,
|
|
<CODE>text/html</CODE>). The second argument sets the number of
|
|
seconds that will be added to a base time to construct the expiration
|
|
date.
|
|
</P>
|
|
<P>
|
|
The base time is either the last modification time of the file, or the
|
|
time of the client's access to the document. Which should be used is
|
|
specified by the <CODE><EM><code></EM></CODE> field;
|
|
<STRONG>M</STRONG> means that the file's last modification time should
|
|
be used as the base time, and <STRONG>A</STRONG> means the client's
|
|
access time should be used.
|
|
</P>
|
|
<P>
|
|
The difference in effect is subtle. If <EM>M</EM> is used, all current
|
|
copies of the document in all caches will expire at the same time,
|
|
which can be good for something like a weekly notice that's always
|
|
found at the same URL. If <EM>A</EM> is used, the date of expiration
|
|
is different for each client; this can be good for image files that
|
|
don't change very often, particularly for a set of related documents
|
|
that all refer to the same images (<EM>i.e.</EM>, the images will be
|
|
accessed repeatedly within a relatively short timespan).
|
|
</P>
|
|
<P>
|
|
<STRONG>Example:</STRONG>
|
|
</P>
|
|
<P>
|
|
<PRE>
|
|
ExpiresActive On # enable expirations
|
|
ExpiresByType image/gif A2592000 # expire GIF images after a month
|
|
# in the client's cache
|
|
ExpiresByType text/html M604800 # HTML documents are good for a
|
|
# week from the time they were
|
|
# changed, period
|
|
</PRE>
|
|
</P>
|
|
<P>
|
|
Note that this directive only has effect if <CODE>ExpiresActive
|
|
On</CODE> has been specified. It overrides, for the specified MIME
|
|
type <EM>only</EM>, any expiration date set by the
|
|
<A
|
|
HREF="#expiresdefault"
|
|
>ExpiresDefault</A>
|
|
directive.
|
|
</P>
|
|
<HR>
|
|
<H2><A NAME="expiresdefault">
|
|
ExpiresDefault directive
|
|
</A></H2>
|
|
<!--%plaintext <?INDEX {\tt ExpiresDefault} directive> -->
|
|
<P>
|
|
<STRONG>Syntax:</STRONG> ExpiresDefault <EM><code>seconds</EM>
|
|
<BR>
|
|
<STRONG>Context:</STRONG> server config, virtual host, directory, .htaccess
|
|
<br>
|
|
<STRONG>Override:</STRONG> Indexes
|
|
<br>
|
|
<STRONG>Status:</STRONG> Extension
|
|
<br>
|
|
<STRONG>Module:</STRONG> mod_expires
|
|
</P>
|
|
<P>
|
|
This directive sets the default algorithm for calculating the
|
|
expiration time for all documents in the affected realm. It can be
|
|
overridden on a type-by-type basis by the
|
|
<A
|
|
HREF="#expiresbytype"
|
|
>ExpiresByType</A>
|
|
directive. See the description of that directive for details about
|
|
the syntax of the argument.
|
|
</P>
|
|
<!--#include virtual="footer.html" -->
|
|
</BODY>
|
|
</HTML>
|