<p>The following directive will activate files ending with
<code>.map</code> as imagemap files:</p>
- <example>AddHandler imap-file map</example>
+ <highlight language="config">AddHandler imap-file map</highlight>
<p>Note that the following is still supported:</p>
- <example>AddType application/x-httpd-imap map</example>
+ <highlight language="config">AddType application/x-httpd-imap map</highlight>
<p>However, we are trying to phase out "magic MIME types" so we
are deprecating this method.</p>
parse them and assign the resulting document the mime type of
<code>text/html</code>:</p>
- <example>
- AddType text/html .shtml<br />
- AddOutputFilter INCLUDES .shtml
- </example>
+ <highlight language="config">
+AddType text/html .shtml
+AddOutputFilter INCLUDES .shtml
+ </highlight>
<p>The following directive must be given for the directories
containing the shtml files (typically in a
<directive module="core">AllowOverride</directive> <code>Options</code>
is set):</p>
- <example>
+ <highlight language="config">
Options +Includes
- </example>
+ </highlight>
<p>For backwards compatibility, the <code>server-parsed</code>
<a href="../handler.html">handler</a> also activates the
<p>This directive changes the string that <module>mod_include</module>
looks for to mark the end of an include element.</p>
- <example><title>Example</title>
+ <highlight language="config">
SSIEndTag "%>"
- </example>
+ </highlight>
</usage>
<seealso><directive module="mod_include">SSIStartTag</directive></seealso>
<p>This directive changes the string that <module>mod_include</module>
displays when a variable is not set and "echoed".</p>
- <example><title>Example</title>
+ <highlight language="config">
SSIUndefinedEcho "<!-- undef -->"
- </example>
+ </highlight>
</usage>
</directivesynopsis>
<p>This directive has the same effect as the <code><!--#config
errmsg=<var>message</var> --></code> element.</p>
- <example><title>Example</title>
+ <highlight language="config">
SSIErrorMsg "<!-- Error -->"
- </example>
+ </highlight>
</usage>
</directivesynopsis>
output of a file each processing different commands (possibly at
different times).</p>
- <example><title>Example</title>
+ <highlight language="config">
SSIStartTag "<%"<br />
SSIEndTag "%>"
- </example>
+ </highlight>
<p>The example given above, which also specifies a matching
<directive module="mod_include">SSIEndTag</directive>, will
<p>This directive has the same effect as the <code><!--#config
timefmt=<var>formatstring</var> --></code> element.</p>
- <example><title>Example</title>
+ <highlight language="config">
SSITimeFormat "%R, %B %d, %Y"
- </example>
+ </highlight>
<p>The above directive would cause times to be displayed in the
format "22:26, June 14, 2002".</p>
<p>To configure <module>mod_info</module>, add the following to your
<code>httpd.conf</code> file.</p>
- <example>
- <Location /server-info><br />
- <indent>
- SetHandler server-info<br />
- </indent>
- </Location>
- </example>
+ <highlight language="config">
+<Location /server-info>
+ SetHandler server-info
+</Location>
+ </highlight>
<p>You may wish to use <module>mod_access</module> inside the
<directive type="section" module="core">Location</directive>
directive to limit access to your server configuration
information:</p>
- <example>
- <Location /server-info><br />
- <indent>
- SetHandler server-info<br />
- Require host example.com<br />
- </indent>
- </Location>
- </example>
+ <highlight language="config">
+<Location /server-info>
+ SetHandler server-info
+ Require host example.com
+</Location>
+ </highlight>
<p>Once configured, the server information is obtained by
accessing <code>http://your.host.example.com/server-info</code></p>
to limit access to your server configuration information.</p>
<example><title>Access control</title>
- <Location /server-info><br />
- <indent>
- SetHandler server-info<br />
- Order allow,deny<br />
- # Allow access from server itself<br />
- Allow from 127.0.0.1<br />
- # Additionally, allow access from local workstation<br />
- Allow from 192.168.1.17<br />
- </indent>
- </Location>
+ <highlight language="config">
+<Location /server-info>
+ SetHandler server-info
+ Order allow,deny
+ # Allow access from server itself
+ Allow from 127.0.0.1
+ # Additionally, allow access from local workstation
+ Allow from 192.168.1.17
+</Location>
+ </highlight>
</example>
</section>
HTML interpreted, <strong>Additional Information</strong> for
the module <var>module-name</var>. Example:</p>
- <example>
- AddModuleInfo mod_deflate.c 'See <a \<br />
- <indent>
- href="http://www.apache.org/docs/&httpd.docs;/mod/mod_deflate.html">\<br />
- http://www.apache.org/docs/&httpd.docs;/mod/mod_deflate.html</a>'
- </indent>
- </example>
+ <highlight language="config">
+AddModuleInfo mod_deflate.c 'See <a \
+ href="http://www.apache.org/docs/&httpd.docs;/mod/mod_deflate.html">\
+ http://www.apache.org/docs/&httpd.docs;/mod/mod_deflate.html</a>'
+ </highlight>
</usage>
</directivesynopsis>
it to them with their file extensions. To enable any .dll file to be
processed as an ISAPI extension, edit the httpd.conf file and add the
following line:</p>
- <example>
+ <highlight language="config">
AddHandler isapi-handler .dll
- </example>
+ </highlight>
<note>In older versions of the Apache server,
<code>isapi-isa</code> was the proper handler name, rather than
requested module loaded. However, you may preload and keep a
specific module loaded by using the following syntax in your
httpd.conf:</p>
- <example>
+ <highlight language="config">
ISAPICacheFile c:/WebWork/Scripts/ISAPI/mytest.dll
- </example>
+ </highlight>
<p>Whether or not you have preloaded an ISAPI extension, all
ISAPI extensions are governed by the same permissions and
<module>mod_ldap</module> to increase the performance of HTTP Basic
authentication provided by <module>mod_authnz_ldap</module>.</p>
- <example>
- # Enable the LDAP connection pool and shared<br />
- # memory cache. Enable the LDAP cache status<br />
- # handler. Requires that mod_ldap and mod_authnz_ldap<br />
- # be loaded. Change the "yourdomain.example.com" to<br />
- # match your domain.<br />
- <br />
- LDAPSharedCacheSize 500000<br />
- LDAPCacheEntries 1024<br />
- LDAPCacheTTL 600<br />
- LDAPOpCacheEntries 1024<br />
- LDAPOpCacheTTL 600<br />
- <br />
- <Location /ldap-status><br />
- <indent>
- SetHandler ldap-status<br />
-
- Require host yourdomain.example.com<br />
-
- Satisfy any<br />
- AuthType Basic<br />
- AuthName "LDAP Protected"<br />
- AuthBasicProvider ldap<br />
- AuthLDAPURL ldap://127.0.0.1/dc=example,dc=com?uid?one<br />
- Require valid-user<br />
- </indent>
- </Location>
- </example>
+ <highlight language="config">
+# Enable the LDAP connection pool and shared
+# memory cache. Enable the LDAP cache status
+# handler. Requires that mod_ldap and mod_authnz_ldap
+# be loaded. Change the "yourdomain.example.com" to
+# match your domain.
+
+LDAPSharedCacheSize 500000
+LDAPCacheEntries 1024
+LDAPCacheTTL 600
+LDAPOpCacheEntries 1024
+LDAPOpCacheTTL 600
+
+<Location /ldap-status>
+ SetHandler ldap-status
+
+ Require host yourdomain.example.com
+
+ Satisfy any
+ AuthType Basic
+ AuthName "LDAP Protected"
+ AuthBasicProvider ldap
+ AuthLDAPURL ldap://127.0.0.1/dc=example,dc=com?uid?one
+ Require valid-user
+</Location>
+ </highlight>
</section>
<section id="pool"><title>LDAP Connection Pool</title>
following directives could be used to access the
<module>mod_ldap</module> cache information:</p>
- <example>
- <Location /server/cache-info><br />
- <indent>
- SetHandler ldap-status<br />
- </indent>
- </Location>
- </example>
+ <highlight language="config">
+<Location /server/cache-info>
+ SetHandler ldap-status
+</Location>
+ </highlight>
<p>By fetching the URL <code>http://servername/cache-info</code>,
the administrator can get a status report of every cache that is used
optional client certificates to be used, as well as the type of
encryption to be used on the connection (none, SSL or TLS/STARTTLS).</p>
- <example>
- # Establish an SSL LDAP connection on port 636. Requires that <br />
- # mod_ldap and mod_authnz_ldap be loaded. Change the <br />
- # "yourdomain.example.com" to match your domain.<br />
- <br />
- LDAPTrustedGlobalCert CA_DER /certs/certfile.der<br />
- <br />
- <Location /ldap-status><br />
- <indent>
- SetHandler ldap-status<br />
-
- Require host yourdomain.example.com<br />
-
- Satisfy any<br />
- AuthType Basic<br />
- AuthName "LDAP Protected"<br />
- AuthBasicProvider ldap<br />
- AuthLDAPURL ldaps://127.0.0.1/dc=example,dc=com?uid?one<br />
- Require valid-user<br />
- </indent>
- </Location>
- </example>
-
- <example>
- # Establish a TLS LDAP connection on port 389. Requires that <br />
- # mod_ldap and mod_authnz_ldap be loaded. Change the <br />
- # "yourdomain.example.com" to match your domain.<br />
- <br />
- LDAPTrustedGlobalCert CA_DER /certs/certfile.der<br />
- <br />
- <Location /ldap-status><br />
- <indent>
- SetHandler ldap-status<br />
-
- Require host yourdomain.example.com<br />
-
- Satisfy any<br />
- AuthType Basic<br />
- AuthName "LDAP Protected"<br />
- AuthBasicProvider ldap<br />
- AuthLDAPURL ldap://127.0.0.1/dc=example,dc=com?uid?one TLS<br />
- Require valid-user<br />
- </indent>
- </Location>
- </example>
+ <highlight language="config">
+# Establish an SSL LDAP connection on port 636. Requires that
+# mod_ldap and mod_authnz_ldap be loaded. Change the
+# "yourdomain.example.com" to match your domain.
+
+LDAPTrustedGlobalCert CA_DER /certs/certfile.der
+
+<Location /ldap-status>
+ SetHandler ldap-status
+
+ Require host yourdomain.example.com
+
+ Satisfy any
+ AuthType Basic
+ AuthName "LDAP Protected"
+ AuthBasicProvider ldap
+ AuthLDAPURL ldaps://127.0.0.1/dc=example,dc=com?uid?one
+ Require valid-user
+</Location>
+ </highlight>
+
+ <highlight language="config">
+# Establish a TLS LDAP connection on port 389. Requires that
+# mod_ldap and mod_authnz_ldap be loaded. Change the
+# "yourdomain.example.com" to match your domain.
+
+LDAPTrustedGlobalCert CA_DER /certs/certfile.der
+
+<Location /ldap-status>
+ SetHandler ldap-status
+
+ Require host yourdomain.example.com
+
+ Satisfy any
+ AuthType Basic
+ AuthName "LDAP Protected"
+ AuthBasicProvider ldap
+ AuthLDAPURL ldap://127.0.0.1/dc=example,dc=com?uid?one TLS
+ Require valid-user
+</Location>
+ </highlight>
</section>
an error when an attempt is made to contact the LDAP server at
runtime.</p>
- <example>
- # Specify a Netscape CA certificate file<br />
- LDAPTrustedGlobalCert CA_CERT7_DB /certs/cert7.db<br />
- # Specify an optional key3.db file for client certificate support<br />
- LDAPTrustedGlobalCert CERT_KEY3_DB /certs/key3.db<br />
- # Specify the secmod file if required<br />
- LDAPTrustedGlobalCert CA_SECMOD /certs/secmod<br />
- <Location /ldap-status><br />
- <indent>
- SetHandler ldap-status<br />
-
- Require host yourdomain.example.com<br />
-
- Satisfy any<br />
- AuthType Basic<br />
- AuthName "LDAP Protected"<br />
- AuthBasicProvider ldap<br />
- LDAPTrustedClientCert CERT_NICKNAME <nickname> [password]<br />
- AuthLDAPURL ldaps://127.0.0.1/dc=example,dc=com?uid?one<br />
- Require valid-user<br />
- </indent>
- </Location>
- </example>
+ <highlight language="config">
+# Specify a Netscape CA certificate file
+LDAPTrustedGlobalCert CA_CERT7_DB /certs/cert7.db
+# Specify an optional key3.db file for client certificate support
+LDAPTrustedGlobalCert CERT_KEY3_DB /certs/key3.db
+# Specify the secmod file if required
+LDAPTrustedGlobalCert CA_SECMOD /certs/secmod
+<Location /ldap-status>
+ SetHandler ldap-status
+
+ Require host yourdomain.example.com
+
+ Satisfy any
+ AuthType Basic
+ AuthName "LDAP Protected"
+ AuthBasicProvider ldap
+ LDAPTrustedClientCert CERT_NICKNAME <nickname> [password]
+ AuthLDAPURL ldaps://127.0.0.1/dc=example,dc=com?uid?one
+ Require valid-user
+</Location>
+ </highlight>
</section>
LDAPTrustedMode parameter. If an ldaps:// URL is specified,
SSL mode is forced, override this directive.</p>
- <example>
- # Specify two CA certificate files<br />
- LDAPTrustedGlobalCert CA_DER /certs/cacert1.der<br />
- LDAPTrustedGlobalCert CA_BASE64 /certs/cacert2.pem<br />
- # Specify a client certificate file and key<br />
- LDAPTrustedGlobalCert CERT_BASE64 /certs/cert1.pem<br />
- LDAPTrustedGlobalCert KEY_BASE64 /certs/key1.pem [password]<br />
- # Do not use this directive, as it will throw an error<br />
- #LDAPTrustedClientCert CERT_BASE64 /certs/cert1.pem<br />
- </example>
+ <highlight language="config">
+# Specify two CA certificate files
+LDAPTrustedGlobalCert CA_DER /certs/cacert1.der
+LDAPTrustedGlobalCert CA_BASE64 /certs/cacert2.pem
+# Specify a client certificate file and key
+LDAPTrustedGlobalCert CERT_BASE64 /certs/cert1.pem
+LDAPTrustedGlobalCert KEY_BASE64 /certs/key1.pem [password]
+# Do not use this directive, as it will throw an error
+#LDAPTrustedClientCert CERT_BASE64 /certs/cert1.pem
+ </highlight>
</section>
(ldaps://) support has been deprecated to be replaced with TLS,
although the SSL functionality still works.</p>
- <example>
- # Specify two CA certificate files<br />
- LDAPTrustedGlobalCert CA_DER /certs/cacert1.der<br />
- LDAPTrustedGlobalCert CA_BASE64 /certs/cacert2.pem<br />
- <Location /ldap-status><br />
- <indent>
- SetHandler ldap-status<br />
-
- Require host yourdomain.example.com<br />
-
- LDAPTrustedClientCert CERT_BASE64 /certs/cert1.pem<br />
- LDAPTrustedClientCert KEY_BASE64 /certs/key1.pem<br />
- # CA certs respecified due to per-directory client certs<br />
- LDAPTrustedClientCert CA_DER /certs/cacert1.der<br />
- LDAPTrustedClientCert CA_BASE64 /certs/cacert2.pem<br />
- Satisfy any<br />
- AuthType Basic<br />
- AuthName "LDAP Protected"<br />
- AuthBasicProvider ldap<br />
- AuthLDAPURL ldaps://127.0.0.1/dc=example,dc=com?uid?one<br />
- Require valid-user<br />
- </indent>
- </Location>
- </example>
+ <highlight language="config">
+# Specify two CA certificate files
+LDAPTrustedGlobalCert CA_DER /certs/cacert1.der
+LDAPTrustedGlobalCert CA_BASE64 /certs/cacert2.pem
+<Location /ldap-status>
+ SetHandler ldap-status
+
+ Require host yourdomain.example.com
+
+ LDAPTrustedClientCert CERT_BASE64 /certs/cert1.pem
+ LDAPTrustedClientCert KEY_BASE64 /certs/key1.pem
+ # CA certs respecified due to per-directory client certs
+ LDAPTrustedClientCert CA_DER /certs/cacert1.der
+ LDAPTrustedClientCert CA_BASE64 /certs/cacert2.pem
+ Satisfy any
+ AuthType Basic
+ AuthName "LDAP Protected"
+ AuthBasicProvider ldap
+ AuthLDAPURL ldaps://127.0.0.1/dc=example,dc=com?uid?one
+ Require valid-user
+</Location>
+ </highlight>
</section>
<p>For example, the following two sets of directives have
exactly the same effect:</p>
- <example>
- # CustomLog with format nickname<br />
- LogFormat "%h %l %u %t \"%r\" %>s %b" common<br />
- CustomLog logs/access_log common<br />
- <br />
- # CustomLog with explicit format string<br />
- CustomLog logs/access_log "%h %l %u %t \"%r\" %>s %b"
- </example>
+ <highlight language="config">
+# CustomLog with format nickname
+LogFormat "%h %l %u %t \"%r\" %>s %b" common
+CustomLog logs/access_log common
+
+# CustomLog with explicit format string
+CustomLog logs/access_log "%h %l %u %t \"%r\" %>s %b"
+ </highlight>
<p>The third argument is optional and controls whether or
not to log a particular request. The condition can be the
images on your server in a separate logfile but not in your main
log, you can use:</p>
- <example>
- SetEnvIf Request_URI \.gif$ gif-image<br />
- CustomLog gif-requests.log common env=gif-image<br />
- CustomLog nongif-requests.log common env=!gif-image
- </example>
+ <highlight language="config">
+SetEnvIf Request_URI \.gif$ gif-image
+CustomLog gif-requests.log common env=gif-image
+CustomLog nongif-requests.log common env=!gif-image
+ </highlight>
<p>Or, to reproduce the behavior of the old RefererIgnore
directive, you might use the following:</p>
- <example>
- SetEnvIf Referer example\.com localreferer<br />
- CustomLog referer.log referer env=!localreferer
- </example>
+ <highlight language="config">
+SetEnvIf Referer example\.com localreferer
+CustomLog referer.log referer env=!localreferer
+ </highlight>
</usage>
</directivesynopsis>
percent signs (<code>%</code>).</p>
<example><title>Example</title>
+ <highlight language="config">
LogFormat "%v %h %l %u %t \"%r\" %>s %b" vhost_common
+ </highlight>
</example>
+
</usage>
</directivesynopsis>
other format has been specified.</p>
<example><title>Example</title>
- LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\""<br />
- TransferLog logs/access_log
+ <highlight language="config">
+LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\""
+TransferLog logs/access_log
+ </highlight>
</example>
</usage>
</directivesynopsis>
<li>
Log message after request to /foo/* is processed:
- <example>
- <Location /foo/><br/>
- LogMessage "/foo/ has been requested"<br/>
- </Location><br/>
- </example>
+ <highlight language="config">
+<Location /foo/>
+ LogMessage "/foo/ has been requested"
+</Location>
+ </highlight>
</li>
<li>
Log message if request to /foo/* is processed in a sub-request:
- <example>
- <Location /foo/><br/>
- LogMessage "subrequest to /foo/" hook=type_checker expr=%{IS_SUBREQ}<br/>
- </Location><br/>
- </example>
+ <highlight language="config">
+<Location /foo/>
+ LogMessage "subrequest to /foo/" hook=type_checker expr=%{IS_SUBREQ}
+</Location>
+ </highlight>
The default log_transaction hook is not executed for sub-requests,
therefore we have to use a different hook.
<li>
Log message if an IPv6 client causes a request timeout:
- <example>
- LogMessage "IPv6 timeout from %{REMOTE_ADDR}"
- "expr=-T %{IPV6} && %{REQUEST_STATUS} = 408"
- </example>
+ <highlight language="config">
+ LogMessage "IPv6 timeout from %{REMOTE_ADDR}" "expr=-T %{IPV6} && %{REQUEST_STATUS} = 408"
+ </highlight>
Note the placing of the double quotes for the <code>expr=</code> argument.
</li>
<li>
Log the value of the "X-Foo" request environment variable in each
stage of the request:
- <example>
- <Location /><br/>
- LogMessage "%{reqenv:X-Foo}" hook=all<br/>
- </Location><br/>
- </example>
+ <highlight language="config">
+<Location />
+ LogMessage "%{reqenv:X-Foo}" hook=all
+</Location>
+ </highlight>
Together with microsecond time stamps in the error log,
<code>hook=all</code> also allows to determine the times spent
in the different parts of the request processing.
<p>The basic module loading directive is</p>
-<example>
+<highlight language="config">
LoadModule lua_module modules/mod_lua.so
-</example>
+</highlight>
<p>
<code>mod_lua</code> provides a handler named <code>lua-script</code>,
which can be used with an <code>AddHandler</code> directive:</p>
-<example>
+<highlight language="config">
AddHandler lua-script .lua
-</example>
+</highlight>
<p>
This will cause <code>mod_lua</code> to handle requests for files
just evaluating a script body CGI style. A handler function looks
something like this:</p>
-<example><title>example.lua</title><pre>
+
+<highlight language="lua">
+<strong>example.lua</strong>
-- example handler
require "string"
r:puts("unknown HTTP method " .. r.method)
end
end
-</pre></example>
+</highlight>
<p>
This handler function just prints out the uri or form encoded
<code>apache2.OK</code>, <code>apache2.DONE</code>, or
<code>apache2.DECLINED</code>, or else an HTTP status code.</p>
-<example><title>translate_name.lua</title><pre>
+<highlight language="lua">
+<strong>translate_name.lua</strong>
-- example hook that rewrites the URI to a filesystem path.
require 'apache2'
-- we don't care about this URL, give another module a chance
return apache2.DECLINED
end
-</pre></example>
+</highlight>
-<example><title>translate_name2.lua</title><pre>
+<highlight language="lua">
+<strong>translate_name2.lua</strong>
--[[ example hook that rewrites one URI to another URI. It returns a
apache2.DECLINED to give other URL mappers a chance to work on the
substitution, including the core translate_name hook which maps based
end
return apache2.DECLINED
end
-</pre></example>
+</highlight>
</section>
<section id="datastructures"><title>Data Structures</title>
<p>The request_rec has (at least) the following methods:</p>
- <example>
+ <highlight language="lua">
r:addoutputfilter(name|function) -- add an output filter
- </example>
+ </highlight>
- <example>
- r:parseargs() -- returns a lua table containing the request's
- query string arguments
- </example>
+ <highlight language="lua">
+ r:parseargs() -- returns a lua table containing the request's query string arguments
+ </highlight>
- <example>
- r:parsebody() -- parse the request body as a POST and return
- a lua table
- </example>
+ <highlight language="lua">
+ r:parsebody() -- parse the request body as a POST and return a lua table
+ </highlight>
- <example>
+ <highlight language="lua">
r:puts("hello", " world", "!") -- print to response body
- </example>
+ </highlight>
- <example>
+ <highlight language="lua">
r:write("a single string") -- print to response body
- </example>
+ </highlight>
</dd>
</dl>
<section id="logging"><title>Logging Functions</title>
-<example>
+<highlight language="lua">
-- examples of logging messages<br />
r:trace1("This is a trace log message") -- trace1 through trace8 can be used <br />
r:debug("This is a debug log message")<br />
r:alert("This is an alert log message")<br />
r:crit("This is an crit log message")<br />
r:emerg("This is an emerg log message")<br />
-</example>
+</highlight>
</section>
be careful writing your regular expressions to avoid security
issues.</p>
<example><title>Examples:</title>
- LuaMapHandler /(\w+)/(/w+) /scripts/$1.lua handle_$2
+ <highlight language="config">
+ LuaMapHandler /(\w+)/(\w+) /scripts/$1.lua handle_$2
+ </highlight>
</example>
<p>This would match uri's such as /photos/show?id=9
to the file /scripts/photos.lua and invoke the
handler function handle_show on the lua vm after
loading that file.</p>
-<example>
+<highlight language="config">
LuaMapHandler /bingo /scripts/wombat.lua
-</example>
+</highlight>
<p>This would invoke the "handle" function, which
is the default if no specific function name is
provided.</p>
lua vms.</p>
<example><title>Examples:</title>
- LuaPackagePath /scripts/lib/?.lua<br />
- LuaPackagePath /scripts/lib/?/init.lua
+ <highlight language="config">
+LuaPackagePath /scripts/lib/?.lua
+LuaPackagePath /scripts/lib/?/init.lua
+ </highlight>
</example>
</usage>
</directivesynopsis>
for development.</p>
<example><title>Examples:</title>
- LuaCodeCache stat<br />
- LuaCodeCache forever<br />
- LuaCodeCache never<br />
+ <highlight language="config">
+LuaCodeCache stat
+LuaCodeCache forever
+LuaCodeCache never
+ </highlight>
</example>
</usage>
<p>Example:</p>
-<example><pre>
+<highlight language="config">
# httpd.conf
LuaHookTranslateName /scripts/conf/hooks.lua silly_mapper
+</highlight>
+<highlight language="lua">
-- /scripts/conf/hooks.lua --
require "apache2"
function silly_mapper(r)
return apache2.DECLINED
end
end
-</pre></example>
+</highlight>
<note><title>Context</title><p>This directive is not valid in <directive
type="section" module="core">Directory</directive>, <directive
a request. This can be used to implement arbitrary authentication
and authorization checking. A very simple example:
</p>
-<example><pre>
+<highlight language="lua">
require 'apache2'
-- fake authcheck hook
end
return apache2.OK
end
-</pre></example>
+</highlight>
<note><title>Ordering</title><p>The optional arguments "early" or "late"
control when this script runs relative to other modules.</p></note>
</usage>
of using <code>AddHandler cgi-script .cgi</code>, use</p>
<example><title>Configure handler based on final extension only</title>
- <FilesMatch \.cgi$>
- <indent>
- SetHandler cgi-script
- </indent>
- </FilesMatch>
+ <highlight language="config">
+<FilesMatch \.cgi$>
+ SetHandler cgi-script
+</FilesMatch>
+ </highlight>
</example>
</section>
resource, in order to tell the client browser about the
encoding method.</p>
- <example>Content-encoding: pkzip</example>
+ <highlight language="config">Content-encoding: pkzip</highlight>
</section>
<section id="charset-lang"><title>Character sets and languages</title>
render the information.</p>
<example>
- Content-Language: en, fr<br />
- Content-Type: text/plain; charset=ISO-8859-1
+Content-Language: en, fr
+Content-Type: text/plain; charset=ISO-8859-1
</example>
<p>The language specification is the two-letter abbreviation
<var>extension</var>.</p>
<example><title>Example</title>
- AddLanguage ja .ja<br />
- AddCharset EUC-JP .euc<br />
- AddCharset ISO-2022-JP .jis<br />
- AddCharset SHIFT_JIS .sjis
+ <highlight language="config">
+AddLanguage ja .ja
+AddCharset EUC-JP .euc
+AddCharset ISO-2022-JP .jis
+AddCharset SHIFT_JIS .sjis
+ </highlight>
</example>
<p>Then the document <code>xxxx.ja.jis</code> will be treated
<var>extension</var>.</p>
<example><title>Example</title>
- AddEncoding x-gzip .gz<br />
- AddEncoding x-compress .Z
+ <highlight language="config">
+AddEncoding x-gzip .gz
+AddEncoding x-compress .Z
+ </highlight>
</example>
<p>This will cause filenames containing the <code>.gz</code> extension
activate CGI scripts with the file extension <code>.cgi</code>, you
might use:</p>
- <example>
+ <highlight language="config">
AddHandler cgi-script .cgi
- </example>
+ </highlight>
<p>Once that has been put into your httpd.conf file, any file containing
the <code>.cgi</code> extension will be treated as a CGI program.</p>
<var>extension</var>.</p>
<example><title>Example</title>
- AddEncoding x-compress .Z<br />
- AddLanguage en .en<br />
- AddLanguage fr .fr
+ <highlight language="config">
+AddEncoding x-compress .Z
+AddLanguage en .en
+AddLanguage fr .fr
+ </highlight>
</example>
<p>Then the document <code>xxxx.en.Z</code> will be treated as
extension, the last one encountered is the one that is used.
That is, for the case of:</p>
- <example>
- AddLanguage en .en<br />
- AddLanguage en-gb .en<br />
- AddLanguage en-us .en
- </example>
+ <highlight language="config">
+AddLanguage en .en
+AddLanguage en-gb .en
+AddLanguage en-us .en
+ </highlight>
<p>documents with the extension <code>.en</code> would be treated as
being <code>en-us</code>.</p>
<code>.shtml</code> files for server-side includes and will then
compress the output using <module>mod_deflate</module>.</p>
- <example>
+ <highlight language="config">
AddOutputFilter INCLUDES;DEFLATE shtml
- </example>
+ </highlight>
<p>If more than one filter is specified, they must be separated
by semicolons in the order in which they should process the
the <directive module="mod_mime">AddOutputFilter</directive>
directive.</p>
- <example>
- # Effective filter "DEFLATE"<br />
- AddOutputFilter DEFLATE shtml<br />
- <Location /foo><br />
- <indent>
- # Effective filter "INCLUDES", replacing "DEFLATE"<br />
- AddOutputFilter INCLUDES shtml<br />
- </indent>
- </Location><br />
- <Location /bar><br />
- <indent>
- # Effective filter "INCLUDES;DEFLATE", replacing "DEFLATE"<br />
- AddOutputFilter INCLUDES;DEFLATE shtml<br />
- </indent>
- </Location><br />
- <Location /bar/baz><br />
- <indent>
- # Effective filter "BUFFER", replacing "INCLUDES;DEFLATE"<br />
- AddOutputFilter BUFFER shtml<br />
- </indent>
- </Location><br />
- <Location /bar/baz/buz><br />
- <indent>
- # No effective filter, replacing "BUFFER"<br />
- RemoveOutputFilter shtml<br />
- </indent>
- </Location>
- </example>
+ <highlight language="config">
+# Effective filter "DEFLATE"
+AddOutputFilter DEFLATE shtml
+<Location /foo>
+ # Effective filter "INCLUDES", replacing "DEFLATE"
+ AddOutputFilter INCLUDES shtml
+</Location>
+<Location /bar>
+ # Effective filter "INCLUDES;DEFLATE", replacing "DEFLATE"
+ AddOutputFilter INCLUDES;DEFLATE shtml
+</Location>
+<Location /bar/baz>
+ # Effective filter "BUFFER", replacing "INCLUDES;DEFLATE"
+ AddOutputFilter BUFFER shtml
+</Location>
+<Location /bar/baz/buz>
+ # No effective filter, replacing "BUFFER"
+ RemoveOutputFilter shtml
+</Location>
+ </highlight>
</usage>
<seealso><directive module="mod_mime">RemoveOutputFilter</directive></seealso>
<seealso><directive module="core">SetOutputFilter</directive></seealso>
</note>
<example><title>Example</title>
+ <highlight language="config">
AddType image/gif .gif
+ </highlight>
</example>
<p>Or, to specify multiple file extensions in one directive:</p>
<example><title>Example</title>
+ <highlight language="config">
AddType image/jpeg jpeg jpg jpe
+ </highlight>
</example>
<p>The <var>extension</var> argument is case-insensitive and can
<code>qs</code>:</p>
<example><title>Example</title>
- Addtype application/rss+xml;qs=0.8 .xml
+ <highlight language="config">
+ AddType application/rss+xml;qs=0.8 .xml
+ </highlight>
</example>
<p>This is useful in situations, <em>e.g.</em> when a client
and filters to participate in Multviews, but will exclude unknown
files:</p>
- <example>
+ <highlight language="config">
MultiviewsMatch Handlers Filters
- </example>
+ </highlight>
<p><directive>MultiviewsMatch</directive> is not allowed in a
<directive type="section" module="core">Location</directive> or <directive
Content-Language header field will be generated.</p>
<example><title>Example</title>
+ <highlight language="config">
DefaultLanguage en
+ </highlight>
</example>
</usage>
<seealso><module>mod_negotiation</module></seealso>
<p>This directive is recommended when you have a virtual filesystem.</p>
<example><title>Example</title>
+ <highlight language="config">
ModMimeUsePathInfo On
+ </highlight>
</example>
<p>If you have a request for <code>/index.php/foo.shtml</code>
be specified with or without a leading dot.</p>
<example><title>Example</title>
+ <highlight language="config">
RemoveCharset .html .shtml
+ </highlight>
</example>
</usage>
</directivesynopsis>
server config files. An example of its use might be:</p>
<example><title>/foo/.htaccess:</title>
- AddEncoding x-gzip .gz<br />
- AddType text/plain .asc<br />
- <Files *.gz.asc><br />
- <indent>
- RemoveEncoding .gz<br />
- </indent>
- </Files>
+ <highlight language="config">
+AddEncoding x-gzip .gz
+AddType text/plain .asc
+<Files *.gz.asc>
+ RemoveEncoding .gz
+</Files>
+ </highlight>
</example>
<p>This will cause <code>foo.gz</code> to be marked as being
config files. An example of its use might be:</p>
<example><title>/foo/.htaccess:</title>
+ <highlight language="config">
AddHandler server-parsed .html
+ </highlight>
</example>
<example><title>/foo/bar/.htaccess:</title>
+ <highlight language="config">
RemoveHandler .html
+ </highlight>
</example>
<p>This has the effect of returning <code>.html</code> files in
be specified with or without a leading dot.</p>
<example><title>Example</title>
+ <highlight language="config">
RemoveOutputFilter shtml
+ </highlight>
</example>
</usage>
<seealso><directive module="mod_mime">AddOutputFilter</directive></seealso>
might be:</p>
<example><title>/foo/.htaccess:</title>
+ <highlight language="config">
RemoveType .cgi
+ </highlight>
</example>
<p>This will remove any special handling of <code>.cgi</code>
server's file.</p>
<example><title>Example</title>
+ <highlight language="config">
MimeMagicFile conf/magic
+ </highlight>
</example>
</usage>
</directivesynopsis>
<code>type-map</code> handler with an <directive
module="mod_mime">AddHandler</directive> directive:</p>
- <example>
+ <highlight language="config">
AddHandler type-map .var
- </example>
+ </highlight>
<p>A request for <code>document.html</code> in this directory will
result in <code>document.html.var</code> being consulted, and the
(equally acceptable) then the first matching variant, <code>en</code>,
will be served.</p>
- <example>
- LanguagePriority en fr de<br />
- ForceLanguagePriority Prefer
- </example>
+ <highlight language="config">
+LanguagePriority en fr de
+ForceLanguagePriority Prefer
+ </highlight>
<p><code>ForceLanguagePriority Fallback</code> uses
<directive module="mod_negotiation">LanguagePriority</directive> to
variant from the <directive module="mod_negotiation"
>LanguagePriority</directive> list below will be served.</p>
- <example>
- LanguagePriority en fr de<br />
- ForceLanguagePriority Fallback
- </example>
+ <highlight language="config">
+LanguagePriority en fr de
+ForceLanguagePriority Fallback
+ </highlight>
<p>Both options, <code>Prefer</code> and <code>Fallback</code>, may be
specified, so either the first matching variant from <directive
express a preference, when handling a Multiviews request. The list
of <var>MIME-lang</var> are in order of decreasing preference.</p>
- <example><title>Example:</title>
+ <highlight language="config">
LanguagePriority en fr de
- </example>
+ </highlight>
<p>For a request for <code>foo.html</code>, where
<code>foo.html.fr</code> and <code>foo.html.de</code> both