mod_substitute.html.en revision 2060bb0b7e53ae377492426fe35fe4d3cf5bf815
10eed2803538d660048f6e733602e82a75ef6885noodl<?xml version="1.0" encoding="ISO-8859-1"?>
10eed2803538d660048f6e733602e82a75ef6885noodl<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
10eed2803538d660048f6e733602e82a75ef6885noodl<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
10eed2803538d660048f6e733602e82a75ef6885noodl XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
10eed2803538d660048f6e733602e82a75ef6885noodl This file is generated from xml source: DO NOT EDIT
10eed2803538d660048f6e733602e82a75ef6885noodl XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
10eed2803538d660048f6e733602e82a75ef6885noodl -->
10eed2803538d660048f6e733602e82a75ef6885noodl<title>mod_substitute - Apache HTTP Server</title>
10eed2803538d660048f6e733602e82a75ef6885noodl<link href="/style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
10eed2803538d660048f6e733602e82a75ef6885noodl<link href="/style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
10eed2803538d660048f6e733602e82a75ef6885noodl<link href="/style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
10eed2803538d660048f6e733602e82a75ef6885noodl<link href="/images/favicon.ico" rel="shortcut icon" /></head>
10eed2803538d660048f6e733602e82a75ef6885noodl<body>
10eed2803538d660048f6e733602e82a75ef6885noodl<div id="page-header">
10eed2803538d660048f6e733602e82a75ef6885noodl<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>
10eed2803538d660048f6e733602e82a75ef6885noodl<p class="apache">Apache HTTP Server Version 2.3</p>
10eed2803538d660048f6e733602e82a75ef6885noodl<img alt="" src="/images/feather.gif" /></div>
10eed2803538d660048f6e733602e82a75ef6885noodl<div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="/images/left.gif" /></a></div>
10eed2803538d660048f6e733602e82a75ef6885noodl<div id="path">
10eed2803538d660048f6e733602e82a75ef6885noodl<a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="../">Version 2.3</a> &gt; <a href="./">Modules</a></div>
10eed2803538d660048f6e733602e82a75ef6885noodl<div id="page-content">
10eed2803538d660048f6e733602e82a75ef6885noodl<div id="preamble"><h1>Apache Module mod_substitute</h1>
10eed2803538d660048f6e733602e82a75ef6885noodl<div class="toplang">
10eed2803538d660048f6e733602e82a75ef6885noodl<p><span>Available Languages: </span><a href="/en/mod/mod_substitute.html" title="English">&nbsp;en&nbsp;</a></p>
10eed2803538d660048f6e733602e82a75ef6885noodl</div>
10eed2803538d660048f6e733602e82a75ef6885noodl<table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Perform search and replace operations on response bodies</td></tr>
10eed2803538d660048f6e733602e82a75ef6885noodl<tr><th><a href="module-dict.html#Status">Status:</a></th><td>Experimental</td></tr>
10eed2803538d660048f6e733602e82a75ef6885noodl<tr><th><a href="module-dict.html#ModuleIdentifier">Module�Identifier:</a></th><td>substitute_module</td></tr>
10eed2803538d660048f6e733602e82a75ef6885noodl<tr><th><a href="module-dict.html#SourceFile">Source�File:</a></th><td>mod_substitute.c</td></tr></table>
10eed2803538d660048f6e733602e82a75ef6885noodl<h3>Summary</h3>
10eed2803538d660048f6e733602e82a75ef6885noodl
10eed2803538d660048f6e733602e82a75ef6885noodl <p><code class="module"><a href="/mod/mod_substitute.html">mod_substitute</a></code> provides a mechanism to perform
10eed2803538d660048f6e733602e82a75ef6885noodl both regular expression and fixed string substitutions on
10eed2803538d660048f6e733602e82a75ef6885noodl response bodies.</p>
10eed2803538d660048f6e733602e82a75ef6885noodl</div>
10eed2803538d660048f6e733602e82a75ef6885noodl<div id="quickview"><h3 class="directives">Directives</h3>
10eed2803538d660048f6e733602e82a75ef6885noodl<ul id="toc">
10eed2803538d660048f6e733602e82a75ef6885noodl<li><img alt="" src="/images/down.gif" /> <a href="#substitute">Substitute</a></li>
10eed2803538d660048f6e733602e82a75ef6885noodl</ul>
10eed2803538d660048f6e733602e82a75ef6885noodl</div>
10eed2803538d660048f6e733602e82a75ef6885noodl
10eed2803538d660048f6e733602e82a75ef6885noodl<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
10eed2803538d660048f6e733602e82a75ef6885noodl<div class="directive-section"><h2><a name="Substitute" id="Substitute">Substitute</a> <a name="substitute" id="substitute">Directive</a></h2>
10eed2803538d660048f6e733602e82a75ef6885noodl<table class="directive">
10eed2803538d660048f6e733602e82a75ef6885noodl<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Pattern to filter the response content</td></tr>
2060bb0b7e53ae377492426fe35fe4d3cf5bf815jim<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Substitute <var>s/pattern/substitution/[infq]</var></code></td></tr>
10eed2803538d660048f6e733602e82a75ef6885noodl<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
10eed2803538d660048f6e733602e82a75ef6885noodl<tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
10eed2803538d660048f6e733602e82a75ef6885noodl<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Experimental</td></tr>
10eed2803538d660048f6e733602e82a75ef6885noodl<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_substitute</td></tr>
10eed2803538d660048f6e733602e82a75ef6885noodl</table>
10eed2803538d660048f6e733602e82a75ef6885noodl <p>The <code class="directive">Substitute</code> directive specifies a
10eed2803538d660048f6e733602e82a75ef6885noodl search and replace pattern to apply to the response body.</p>
10eed2803538d660048f6e733602e82a75ef6885noodl
10eed2803538d660048f6e733602e82a75ef6885noodl <p>The meaning of the pattern can be modified by using any
10eed2803538d660048f6e733602e82a75ef6885noodl combination of these flags:</p>
10eed2803538d660048f6e733602e82a75ef6885noodl
10eed2803538d660048f6e733602e82a75ef6885noodl <dl>
10eed2803538d660048f6e733602e82a75ef6885noodl <dt><code>i</code></dt>
10eed2803538d660048f6e733602e82a75ef6885noodl <dd>Perform a case-insensitive match.</dd>
10eed2803538d660048f6e733602e82a75ef6885noodl <dt><code>n</code></dt>
10eed2803538d660048f6e733602e82a75ef6885noodl <dd>By default the pattern is treated as a regular expression.
10eed2803538d660048f6e733602e82a75ef6885noodl Using the <code>n</code> flag forces the pattern to be treated
10eed2803538d660048f6e733602e82a75ef6885noodl as a fixed string.</dd>
10eed2803538d660048f6e733602e82a75ef6885noodl <dt><code>f</code></dt>
10eed2803538d660048f6e733602e82a75ef6885noodl <dd>The <code>f</code> flag causes mod_substitute to flatten the
10eed2803538d660048f6e733602e82a75ef6885noodl result of a substitution allowing for later substitutions to
2060bb0b7e53ae377492426fe35fe4d3cf5bf815jim take place on the boundary of this one. This is the default.</dd>
2060bb0b7e53ae377492426fe35fe4d3cf5bf815jim <dt><code>q</code></dt>
2060bb0b7e53ae377492426fe35fe4d3cf5bf815jim <dd>The <code>q</code> flag causes mod_substitute to not
2060bb0b7e53ae377492426fe35fe4d3cf5bf815jim flatten the buckets after each substitution. This can
2060bb0b7e53ae377492426fe35fe4d3cf5bf815jim result in much faster response and a decrease in memory
2060bb0b7e53ae377492426fe35fe4d3cf5bf815jim utilization, but should only be used if there is no possibility
2060bb0b7e53ae377492426fe35fe4d3cf5bf815jim that the result of one substitution will ever match a pattern
2060bb0b7e53ae377492426fe35fe4d3cf5bf815jim or regex of a subsequent one.</dd>
10eed2803538d660048f6e733602e82a75ef6885noodl </dl>
10eed2803538d660048f6e733602e82a75ef6885noodl
10eed2803538d660048f6e733602e82a75ef6885noodl <div class="example"><h3>Example</h3><p><code>
10eed2803538d660048f6e733602e82a75ef6885noodl &lt;Location /&gt;
10eed2803538d660048f6e733602e82a75ef6885noodl <span class="indent">
10eed2803538d660048f6e733602e82a75ef6885noodl AddOutputFilterByType SUBSTITUTE text/html<br />
10eed2803538d660048f6e733602e82a75ef6885noodl Substitute s/foo/bar/ni<br />
10eed2803538d660048f6e733602e82a75ef6885noodl </span>
10eed2803538d660048f6e733602e82a75ef6885noodl &lt;/Location&gt;
10eed2803538d660048f6e733602e82a75ef6885noodl </code></p></div>
10eed2803538d660048f6e733602e82a75ef6885noodl
10eed2803538d660048f6e733602e82a75ef6885noodl <p>If either the pattern or the substitution contain a slash
10eed2803538d660048f6e733602e82a75ef6885noodl character then an alternative delimiter should be used:</p>
10eed2803538d660048f6e733602e82a75ef6885noodl
10eed2803538d660048f6e733602e82a75ef6885noodl <div class="example"><h3>Example of using an alternate delimiter</h3><p><code>
10eed2803538d660048f6e733602e82a75ef6885noodl &lt;Location /&gt;
10eed2803538d660048f6e733602e82a75ef6885noodl <span class="indent">
10eed2803538d660048f6e733602e82a75ef6885noodl AddOutputFilterByType SUBSTITUTE text/html<br />
10eed2803538d660048f6e733602e82a75ef6885noodl Substitute "s|&lt;BR */?&gt;|&lt;br /&gt;|i"
10eed2803538d660048f6e733602e82a75ef6885noodl </span>
10eed2803538d660048f6e733602e82a75ef6885noodl &lt;/Location&gt;
10eed2803538d660048f6e733602e82a75ef6885noodl </code></p></div>
10eed2803538d660048f6e733602e82a75ef6885noodl
10eed2803538d660048f6e733602e82a75ef6885noodl</div>
10eed2803538d660048f6e733602e82a75ef6885noodl</div>
10eed2803538d660048f6e733602e82a75ef6885noodl<div class="bottomlang">
10eed2803538d660048f6e733602e82a75ef6885noodl<p><span>Available Languages: </span><a href="/en/mod/mod_substitute.html" title="English">&nbsp;en&nbsp;</a></p>
10eed2803538d660048f6e733602e82a75ef6885noodl</div><div id="footer">
eac602f079a7b6a1039df751710a2c734c5f67cenoirin<p class="apache">Copyright 2008 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>
10eed2803538d660048f6e733602e82a75ef6885noodl<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>
10eed2803538d660048f6e733602e82a75ef6885noodl</body></html>