Apache HTTP Server Version 2.0
Description: | Generation of
Expires HTTP headers according to user-specified
criteria |
---|---|
Status: | Extension |
Module Identifier: | expires_module |
Source File: | mod_expires.c |
This module controls the setting of the Expires
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.
The Expires
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.
The ExpiresDefault
and
ExpiresByType
directives
can also be defined in a more readable syntax of the form:
ExpiresDefault "<base> [plus] {<num>
<type>}*"
ExpiresByType type/encoding "<base> [plus]
{<num> <type>}*"
where <base> is one of:
access
now
(equivalent to
'access
')modification
The 'plus
' keyword is optional. <num>
should be an integer value [acceptable to atoi()
],
and <type> is one of:
years
months
weeks
days
hours
minutes
seconds
For example, any of the following directives can be used to make documents expire 1 month after being accessed, by default:
ExpiresDefault "access plus 1 month"
ExpiresDefault "access plus 4 weeks"
ExpiresDefault "access plus 30 days"
The expiry time can be fine-tuned by adding several '<num> <type>' clauses:
ExpiresByType text/html "access plus 1 month 15
days 2 hours"
ExpiresByType image/gif "modification plus 5 hours 3
minutes"
Note that if you use a modification date based setting, the Expires header will not be added to content that does not come from a file on disk. This is due to the fact that there is no modification time for such content.
Description: | Enables generation of Expires headers |
---|---|
Syntax: | ExpiresActive On|Off |
Context: | server config, virtual host, directory, .htaccess |
Override: | Indexes |
Status: | Extension |
Module: | mod_expires |
This directive enables or disables the generation of the
Expires
header for the document realm in question.
(That is, if found in an .htaccess
file, for
instance, it applies only to documents generated from that
directory.) If set to Off
, no
Expires
header will be generated for any document
in the realm (unless overridden at a lower level, such as an
.htaccess
file overriding a server config file).
If set to On
, the header will be added to
served documents according to the criteria defined by the
ExpiresByType
and
ExpiresDefault
directives
(q.v.).
Note that this directive does not guarantee that an
Expires
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.
Description: | Value of the Expires header configured by MIME type |
---|---|
Syntax: | ExpiresByType MIME-type <code>seconds |
Context: | server config, virtual host, directory, .htaccess |
Override: | Indexes |
Status: | Extension |
Module: | mod_expires |
This directive defines the value of the Expires
header generated for documents of the specified type
(e.g., text/html
). The second argument
sets the number of secondHTTP/1.1 200 OK
Date: Mon, 07 Jul 2025 08:45:26 GMT
Server: Apache/2.0.42 (Win32) PHP/5.2.10
Content-Location: mod_expires.html.en
Vary: negotiate
TCN: choice
Accept-Ranges: bytes
Content-Length: 12791
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=ISO-8859-1
Content-Language: en
Apache HTTP Server Version 2.0
Description: | Generation of
Expires HTTP headers according to user-specified
criteria |
---|---|
Status: | Extension |
Module Identifier: | expires_module |
Source File: | mod_expires.c |
This module controls the setting of the Expires
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.
The Expires
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.