mod_include.html.en revision 02c4e4fe19f1120c6bdf561950ab60077c61cc5f
beaad6ac31022179c44d88536811e9ccd9425696nd<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
beaad6ac31022179c44d88536811e9ccd9425696nd<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
db878466c5e95073429dda0bdd001f45e9486e16fielding XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
db878466c5e95073429dda0bdd001f45e9486e16fielding This file is generated from xml source: DO NOT EDIT
db878466c5e95073429dda0bdd001f45e9486e16fielding XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
db878466c5e95073429dda0bdd001f45e9486e16fielding<link href="/style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
beaad6ac31022179c44d88536811e9ccd9425696nd<link href="/style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
beaad6ac31022179c44d88536811e9ccd9425696nd<link href="/style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
beaad6ac31022179c44d88536811e9ccd9425696nd<link href="/images/favicon.ico" rel="shortcut icon" /></head>
beaad6ac31022179c44d88536811e9ccd9425696nd<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.html">Directives</a> | <a href="/faq/">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p>
beaad6ac31022179c44d88536811e9ccd9425696nd<div class="up"><a href="./"><img title="<-" alt="<-" src="/images/left.gif" /></a></div>
01c674544bd4c211141bcd9fb09b96ffc18c6c3dnd<a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="../">Version 2.3</a> > <a href="./">Modules</a></div>
3726777f47ac4bba3e21b075905959bbea47e72eerikabele<p><span>Available Languages: </span><a href="/en/mod/mod_include.html" title="English"> en </a> |
3726777f47ac4bba3e21b075905959bbea47e72eerikabele<a href="/ja/mod/mod_include.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a></p>
7e68fce3cbd2246164e045a51ecd77f9f26680ednd<table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Server-parsed html documents (Server Side Includes)</td></tr>
7e68fce3cbd2246164e045a51ecd77f9f26680ednd<tr><th><a href="module-dict.html#Status">Status:</a></th><td>Base</td></tr>
7e68fce3cbd2246164e045a51ecd77f9f26680ednd<tr><th><a href="module-dict.html#ModuleIdentifier">Module�Identifier:</a></th><td>include_module</td></tr>
7e68fce3cbd2246164e045a51ecd77f9f26680ednd<tr><th><a href="module-dict.html#SourceFile">Source�File:</a></th><td>mod_include.c</td></tr>
7e68fce3cbd2246164e045a51ecd77f9f26680ednd<tr><th><a href="module-dict.html#Compatibility">Compatibility:</a></th><td>Implemented as an output filter since Apache
7e68fce3cbd2246164e045a51ecd77f9f26680ednd <p>This module provides a filter which will process files
3726777f47ac4bba3e21b075905959bbea47e72eerikabele before they are sent to the client. The processing is
3726777f47ac4bba3e21b075905959bbea47e72eerikabele controlled by specially formatted SGML comments, referred to as
7e68fce3cbd2246164e045a51ecd77f9f26680ednd <dfn>elements</dfn>. These elements allow conditional text, the
a32843995c13450ba9433b733242977cb4970265nd inclusion of other files or programs, as well as the setting and
a32843995c13450ba9433b733242977cb4970265nd printing of environment variables.</p>
a32843995c13450ba9433b733242977cb4970265nd<div id="quickview"><h3 class="directives">Directives</h3>
a32843995c13450ba9433b733242977cb4970265nd<li><img alt="" src="/images/down.gif" /> <a href="#ssiaccessenable">SSIAccessEnable</a></li>
a32843995c13450ba9433b733242977cb4970265nd<li><img alt="" src="/images/down.gif" /> <a href="#ssiendtag">SSIEndTag</a></li>
a32843995c13450ba9433b733242977cb4970265nd<li><img alt="" src="/images/down.gif" /> <a href="#ssierrormsg">SSIErrorMsg</a></li>
8a72c24379e10c3f3d0dfe352bf15e45ee65c179nd<li><img alt="" src="/images/down.gif" /> <a href="#ssietag">SSIETag</a></li>
a8571599bf3a6921cc0b9f609009e4ec1f59e1d0nd<li><img alt="" src="/images/down.gif" /> <a href="#ssilastmodified">SSILastModified</a></li>
a8571599bf3a6921cc0b9f609009e4ec1f59e1d0nd<li><img alt="" src="/images/down.gif" /> <a href="#ssistarttag">SSIStartTag</a></li>
7e68fce3cbd2246164e045a51ecd77f9f26680ednd<li><img alt="" src="/images/down.gif" /> <a href="#ssitimeformat">SSITimeFormat</a></li>
7e68fce3cbd2246164e045a51ecd77f9f26680ednd<li><img alt="" src="/images/down.gif" /> <a href="#ssiundefinedecho">SSIUndefinedEcho</a></li>
7e68fce3cbd2246164e045a51ecd77f9f26680ednd<li><img alt="" src="/images/down.gif" /> <a href="#xbithack">XBitHack</a></li>
7e68fce3cbd2246164e045a51ecd77f9f26680ednd<li><img alt="" src="/images/down.gif" /> <a href="#enabling">Enabling Server-Side Includes</a></li>
7e68fce3cbd2246164e045a51ecd77f9f26680ednd<li><img alt="" src="/images/down.gif" /> <a href="#pathinfo">PATH_INFO with Server Side Includes</a></li>
7e68fce3cbd2246164e045a51ecd77f9f26680ednd<li><img alt="" src="/images/down.gif" /> <a href="#elements">Basic Elements</a></li>
3726777f47ac4bba3e21b075905959bbea47e72eerikabele<li><img alt="" src="/images/down.gif" /> <a href="#includevars">Include Variables</a></li>
8cfbcde8e416fd60132dd4324c42a5098da156cfnd<li><img alt="" src="/images/down.gif" /> <a href="#substitution">Variable Substitution</a></li>
8cfbcde8e416fd60132dd4324c42a5098da156cfnd<li><img alt="" src="/images/down.gif" /> <a href="#flowctrl">Flow Control Elements</a></li>
7e68fce3cbd2246164e045a51ecd77f9f26680ednd<li><code class="directive"><a href="/mod/core.html#options">Options</a></code></li>
7e68fce3cbd2246164e045a51ecd77f9f26680ednd<li><code class="directive"><a href="/mod/core.html#acceptpathinfo">AcceptPathInfo</a></code></li>
7e68fce3cbd2246164e045a51ecd77f9f26680ednd<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
7e68fce3cbd2246164e045a51ecd77f9f26680ednd<h2><a name="enabling" id="enabling">Enabling Server-Side Includes</a></h2>
7e68fce3cbd2246164e045a51ecd77f9f26680ednd <p>Server Side Includes are implemented by the
7e68fce3cbd2246164e045a51ecd77f9f26680ednd <code>INCLUDES</code> <a href="/filter.html">filter</a>. If
7e68fce3cbd2246164e045a51ecd77f9f26680ednd documents containing server-side include directives are given
7e68fce3cbd2246164e045a51ecd77f9f26680ednd the extension .shtml, the following directives will make Apache
7e68fce3cbd2246164e045a51ecd77f9f26680ednd parse them and assign the resulting document the mime type of
7e68fce3cbd2246164e045a51ecd77f9f26680ednd AddOutputFilter INCLUDES .shtml
7e68fce3cbd2246164e045a51ecd77f9f26680ednd <p>The following directive must be given for the directories
7e68fce3cbd2246164e045a51ecd77f9f26680ednd containing the shtml files (typically in a
7e68fce3cbd2246164e045a51ecd77f9f26680ednd <code class="directive"><a href="/mod/core.html#directory"><Directory></a></code> section,
7e68fce3cbd2246164e045a51ecd77f9f26680ednd but this directive is also valid in <code>.htaccess</code> files if
7e68fce3cbd2246164e045a51ecd77f9f26680ednd <code class="directive"><a href="/mod/core.html#allowoverride">AllowOverride</a></code> <code>Options</code>
7e68fce3cbd2246164e045a51ecd77f9f26680ednd is set):</p>
7e68fce3cbd2246164e045a51ecd77f9f26680ednd Options +Includes
7e68fce3cbd2246164e045a51ecd77f9f26680ednd <p>For backwards compatibility, the <code>server-parsed</code>
7e68fce3cbd2246164e045a51ecd77f9f26680ednd INCLUDES filter. As well, Apache will activate the INCLUDES
7e68fce3cbd2246164e045a51ecd77f9f26680ednd filter for any document with mime type
7e68fce3cbd2246164e045a51ecd77f9f26680ednd <code>text/x-server-parsed-html3</code> (and the resulting
7e68fce3cbd2246164e045a51ecd77f9f26680ednd output will have the mime type <code>text/html</code>).</p>
7e68fce3cbd2246164e045a51ecd77f9f26680ednd <p>For more information, see our <a href="/howto/ssi.html">Tutorial on Server Side Includes</a>.</p>
7e68fce3cbd2246164e045a51ecd77f9f26680ednd</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
7e68fce3cbd2246164e045a51ecd77f9f26680ednd<h2><a name="pathinfo" id="pathinfo">PATH_INFO with Server Side Includes</a></h2>
7e68fce3cbd2246164e045a51ecd77f9f26680ednd <p>Files processed for server-side includes no longer accept
7e68fce3cbd2246164e045a51ecd77f9f26680ednd requests with <code>PATH_INFO</code> (trailing pathname information)
7e68fce3cbd2246164e045a51ecd77f9f26680ednd by default. You can use the <code class="directive"><a href="/mod/core.html#acceptpathinfo">AcceptPathInfo</a></code> directive to
7e68fce3cbd2246164e045a51ecd77f9f26680ednd configure the server to accept requests with <code>PATH_INFO</code>.</p>
7e68fce3cbd2246164e045a51ecd77f9f26680ednd</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
7e68fce3cbd2246164e045a51ecd77f9f26680ednd<h2><a name="elements" id="elements">Basic Elements</a></h2>
7e68fce3cbd2246164e045a51ecd77f9f26680ednd <p>The document is parsed as an HTML document, with special
480bee29abcc415b6b8c18d2ecbf2c5f88f1f05bnd commands embedded as SGML comments. A command has the syntax: </p>
7e68fce3cbd2246164e045a51ecd77f9f26680ednd <!--#<var>element</var> <var>attribute</var>=<var>value</var>
7e68fce3cbd2246164e045a51ecd77f9f26680ednd <p>The value will often be enclosed in double quotes, but single
7e68fce3cbd2246164e045a51ecd77f9f26680ednd quotes (<code>'</code>) and backticks (<code>`</code>) are also
7e68fce3cbd2246164e045a51ecd77f9f26680ednd possible. Many commands only allow a single attribute-value pair.
7e68fce3cbd2246164e045a51ecd77f9f26680ednd Note that the comment terminator (<code>--></code>) should be
7e68fce3cbd2246164e045a51ecd77f9f26680ednd preceded by whitespace to ensure that it isn't considered part of
7e68fce3cbd2246164e045a51ecd77f9f26680ednd an SSI token. Note that the leading <code><!--#</code> is <em>one</em>
7e68fce3cbd2246164e045a51ecd77f9f26680ednd token and may not contain any whitespaces.</p>
3726777f47ac4bba3e21b075905959bbea47e72eerikabele <p>The allowed elements are listed in the following table:</p>
<code class="module"><a href="/mod/mod_include.html">mod_include</a></code>. In fact, the <code><a href="#element.exec">exec</a></code> element is provided by
<code class="module"><a href="/mod/mod_cgi.html">mod_cgi</a></code>, and will only be available if this
attempts to echo an undefined variable. This overrides any <code class="directive"><a href="#ssiundefinedecho">SSIUndefinedEcho</a></code> directives.</dd>
document. This overrides any <code class="directive"><a href="#ssierrormsg">SSIErrorMsg</a></code> directives.</dd>
determined by the <code class="directive"><a href="#ssiundefinedecho">SSIUndefinedEcho</a></code> directive. Any dates printed are
CGI script. It requires <code class="module"><a href="/mod/mod_cgi.html">mod_cgi</a></code> to be present
<code>/bin/sh</code>. The <a href="#includevars">include variables</a> are available to the command, in addition
<p>The use of <code><a href="#includevirtual">#include virtual</a></code> is almost always prefered to using
<a class="glossarylink" href="/glossary.html#mime-type" title="see glossary">MIME-type</a> (<code>text/plain</code>,
<p>If the <code class="directive"><a href="/mod/mod_request.html#keptbodysize">KeptBodySize</a></code>
<!--#include virtual="/path-a.html" onerror="/error-a.html" virtual="/path-b.html" onerror="/error-b.html" -->
their values. Special characters are entity encoded (see the <code><a href="#element.echo">echo</a></code> element for details)
if the URL is modified internally (e.g. by an <code class="directive"><a href="/mod/mod_alias.html#alias">alias</a></code> or <code class="directive"><a href="/mod/mod_dir.html#directoryindex">directoryindex</a></code>), the modified
<div class="example"><p><code><var>string1</var> <var>string2</var></code> results in <code><var>string1</var> <var>string2</var></code><br />
<code>'<var>string1</var> <var>string2</var>'</code> results in <code><var>string1</var> <var>string2</var></code>.</p></div>
above that means, <code class="module"><a href="/mod/mod_include.html">mod_include</a></code> evaluates at first
<div class="directive-section"><h2><a name="SSIAccessEnable" id="SSIAccessEnable">SSIAccessEnable</a> <a name="ssiaccessenable" id="ssiaccessenable">Directive</a></h2>
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enable the -A flag during conditional flow control processing.</td></tr>
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SSIAccessEnable on|off</code></td></tr>
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>SSIAccessEnable off</code></td></tr>
<div class="directive-section"><h2><a name="SSIEndTag" id="SSIEndTag">SSIEndTag</a> <a name="ssiendtag" id="ssiendtag">Directive</a></h2>
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>String that ends an include element</td></tr>
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SSIEndTag <var>tag</var></code></td></tr>
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>SSIEndTag "-->"</code></td></tr>
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.0.30 and later.</td></tr>
<p>This directive changes the string that <code class="module"><a href="/mod/mod_include.html">mod_include</a></code>
<div class="directive-section"><h2><a name="SSIErrorMsg" id="SSIErrorMsg">SSIErrorMsg</a> <a name="ssierrormsg" id="ssierrormsg">Directive</a></h2>
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Error message displayed when there is an SSI
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SSIErrorMsg <var>message</var></code></td></tr>
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>SSIErrorMsg "[an error occurred while processing this
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.0.30 and later.</td></tr>
message displayed when <code class="module"><a href="/mod/mod_include.html">mod_include</a></code> encounters an
<div class="directive-section"><h2><a name="SSIETag" id="SSIETag">SSIETag</a> <a name="ssietag" id="ssietag">Directive</a></h2>
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Controls whether ETags are generated by the server.</td></tr>
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SSIETag on|off</code></td></tr>
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>SSIETag off</code></td></tr>
<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.2.15 and later.</td></tr>
<p>Under normal circumstances, a file filtered by <code class="module"><a href="/mod/mod_include.html">mod_include</a></code>
<code class="module"><a href="/mod/mod_include.html">mod_include</a></code> regardless of the value of this setting.
<div class="directive-section"><h2><a name="SSILastModified" id="SSILastModified">SSILastModified</a> <a name="ssilastmodified" id="ssilastmodified">Directive</a></h2>
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Controls whether <code>Last-Modified</code> headers are generated by the
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SSILastModified on|off</code></td></tr>
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>SSILastModified off</code></td></tr>
<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.2.15 and later.</td></tr>
<p>Under normal circumstances, a file filtered by <code class="module"><a href="/mod/mod_include.html">mod_include</a></code>
<div class="directive-section"><h2><a name="SSIStartTag" id="SSIStartTag">SSIStartTag</a> <a name="ssistarttag" id="ssistarttag">Directive</a></h2>
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>String that starts an include element</td></tr>
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SSIStartTag <var>tag</var></code></td></tr>
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>SSIStartTag "<!--#"</code></td></tr>
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.0.30 and later.</td></tr>
<p>This directive changes the string that <code class="module"><a href="/mod/mod_include.html">mod_include</a></code>
<div class="directive-section"><h2><a name="SSITimeFormat" id="SSITimeFormat">SSITimeFormat</a> <a name="ssitimeformat" id="ssitimeformat">Directive</a></h2>
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configures the format in which date strings are
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SSITimeFormat <var>formatstring</var></code></td></tr>
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>SSITimeFormat "%A, %d-%b-%Y %H:%M:%S %Z"</code></td></tr>
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.0.30 and later.</td></tr>
<div class="directive-section"><h2><a name="SSIUndefinedEcho" id="SSIUndefinedEcho">SSIUndefinedEcho</a> <a name="ssiundefinedecho" id="ssiundefinedecho">Directive</a></h2>
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>String displayed when an unset variable is echoed</td></tr>
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SSIUndefinedEcho <var>string</var></code></td></tr>
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>SSIUndefinedEcho "(none)"</code></td></tr>
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.0.34 and later.</td></tr>
<p>This directive changes the string that <code class="module"><a href="/mod/mod_include.html">mod_include</a></code>
<div class="directive-section"><h2><a name="XBitHack" id="XBitHack">XBitHack</a> <a name="xbithack" id="xbithack">Directive</a></h2>
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Parse SSI directives in files with the execute bit
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>XBitHack on|off|full</code></td></tr>
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>XBitHack off</code></td></tr>
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
with the <a class="glossarylink" href="/glossary.html#mime-type" title="see glossary">MIME-type</a> <code>text/html</code>. <code class="directive">XBitHack</code> can take on the following values:</p>
group-execute bit is unset for every SSI script which might <code>#include</code> a CGI or otherwise produces different output on
<p><span>Available Languages: </span><a href="/en/mod/mod_include.html" title="English"> en </a> |
<a href="/ja/mod/mod_include.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a></p>
<p class="apache">Copyright 2010 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.html">Directives</a> | <a href="/faq/">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p></div>