github.com/krum110487/go-htaccess@v0.0.0-20240316004156-60641c8e7598/tests/data/apache_2_2_34/manual/mod/mod_substitute.html.en (about)

     1  <?xml version="1.0" encoding="ISO-8859-1"?>
     2  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
     3  <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
     4  <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type" />
     5  <!--
     6          XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
     7                This file is generated from xml source: DO NOT EDIT
     8          XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
     9        -->
    10  <title>mod_substitute - Apache HTTP Server Version 2.2</title>
    11  <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
    12  <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
    13  <link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="../style/css/prettify.css" />
    14  <script src="../style/scripts/prettify.min.js" type="text/javascript">
    15  </script>
    16  
    17  <link href="../images/favicon.ico" rel="shortcut icon" /><link href="http://httpd.apache.org/docs/current/mod/mod_substitute.html" rel="canonical" /></head>
    18  <body>
    19  <div id="page-header">
    20  <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
    21  <p class="apache">Apache HTTP Server Version 2.2</p>
    22  <img alt="" src="../images/feather.gif" /></div>
    23  <div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="../images/left.gif" /></a></div>
    24  <div id="path">
    25  <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.2</a> &gt; <a href="./">Modules</a></div>
    26  <div id="page-content">
    27  <div class="retired"><h4>Please note</h4>
    28              <p> This document refers to a legacy release (<strong>2.2</strong>) of Apache httpd. The active release (<strong>2.4</strong>) is documented <a href="http://httpd.apache.org/docs/current">here</a>. If you have not already upgraded, please follow <a href="http://httpd.apache.org/docs/current/upgrading.html">this link</a> for more information.</p>
    29          <p>You may follow <a href="http://httpd.apache.org/docs/current/mod/mod_substitute.html">this link</a> to go to the current version of this document.</p></div><div id="preamble"><h1>Apache Module mod_substitute</h1>
    30  <div class="toplang">
    31  <p><span>Available Languages: </span><a href="../en/mod/mod_substitute.html" title="English">&nbsp;en&nbsp;</a></p>
    32  </div>
    33  <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>
    34  <tr><th><a href="module-dict.html#Status">Status:</a></th><td>Extension</td></tr>
    35  <tr><th><a href="module-dict.html#ModuleIdentifier">Module Identifier:</a></th><td>substitute_module</td></tr>
    36  <tr><th><a href="module-dict.html#SourceFile">Source File:</a></th><td>mod_substitute.c</td></tr>
    37  <tr><th><a href="module-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.2.7 and later</td></tr></table>
    38  <h3>Summary</h3>
    39  
    40      <p><code class="module"><a href="../mod/mod_substitute.html">mod_substitute</a></code> provides a mechanism to perform
    41      both regular expression and fixed string substitutions on
    42      response bodies.</p>
    43  </div>
    44  <div id="quickview"><h3 class="directives">Directives</h3>
    45  <ul id="toc">
    46  <li><img alt="" src="../images/down.gif" /> <a href="#substitute">Substitute</a></li>
    47  <li><img alt="" src="../images/down.gif" /> <a href="#substituteinheritbefore">SubstituteInheritBefore</a></li>
    48  </ul>
    49  <ul class="seealso"><li><a href="#comments_section">Comments</a></li></ul></div>
    50  
    51  <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
    52  <div class="directive-section"><h2><a name="Substitute" id="Substitute">Substitute</a> <a name="substitute" id="substitute">Directive</a></h2>
    53  <table class="directive">
    54  <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Pattern to filter the response content</td></tr>
    55  <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Substitute <var>s/pattern/substitution/[infq]</var></code></td></tr>
    56  <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
    57  <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
    58  <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
    59  <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_substitute</td></tr>
    60  </table>
    61      <p>The <code class="directive">Substitute</code> directive specifies a
    62      search and replace pattern to apply to the response body.</p>
    63      
    64      <p>The meaning of the pattern can be modified by using any
    65      combination of these flags:</p>
    66      
    67      <dl>
    68          <dt><code>i</code></dt>
    69          <dd>Perform a case-insensitive match.</dd>
    70          <dt><code>n</code></dt>
    71          <dd>By default the pattern is treated as a regular expression.
    72          Using the <code>n</code> flag forces the pattern to be treated
    73          as a fixed string.</dd>
    74          <dt><code>f</code></dt>
    75          <dd>The <code>f</code> flag causes mod_substitute to flatten the
    76          result of a substitution allowing for later substitutions to
    77          take place on the boundary of this one. This is the default.</dd>
    78          <dt><code>q</code></dt>
    79          <dd>The <code>q</code> flag causes mod_substitute to not
    80          flatten the buckets after each substitution. This can
    81          result in much faster response and a decrease in memory
    82          utilization, but should only be used if there is no possibility
    83          that the result of one substitution will ever match a pattern
    84          or regex of a subsequent one.</dd>
    85      </dl>
    86      
    87      <div class="example"><h3>Example</h3><p><code>
    88          &lt;Location /&gt;
    89          <span class="indent">
    90              AddOutputFilterByType SUBSTITUTE text/html<br />
    91              Substitute s/foo/bar/ni<br />
    92          </span>
    93          &lt;/Location&gt;
    94      </code></p></div>
    95      
    96      <p>If either the pattern or the substitution contain a slash
    97      character then an alternative delimiter should be used:</p>
    98      
    99      <div class="example"><h3>Example of using an alternate delimiter</h3><p><code>
   100          &lt;Location /&gt;
   101          <span class="indent">
   102              AddOutputFilterByType SUBSTITUTE text/html<br />
   103              Substitute "s|&lt;BR */?&gt;|&lt;br /&gt;|i"
   104          </span>
   105          &lt;/Location&gt;
   106      </code></p></div>
   107  
   108  </div>
   109  <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
   110  <div class="directive-section"><h2><a name="SubstituteInheritBefore" id="SubstituteInheritBefore">SubstituteInheritBefore</a> <a name="substituteinheritbefore" id="substituteinheritbefore">Directive</a></h2>
   111  <table class="directive">
   112  <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Change the merge order of inherited patterns</td></tr>
   113  <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SubstituteInheritBefore on|off</code></td></tr>
   114  <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>SubstituteInheritBefore off</code></td></tr>
   115  <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
   116  <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
   117  <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
   118  <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_substitute</td></tr>
   119  <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in httpd 2.2.32 and later</td></tr>
   120  </table>
   121      <p>Whether to apply the inherited <code class="directive">Substitute</code>
   122      patterns first (<code>on</code>), or after the ones of the current
   123      context (<code>off</code>).
   124      <code class="directive">SubstituteInheritBefore</code> is itself inherited,
   125      hence contexts that inherit it (those that don't specify their own
   126      <code class="directive">SubstituteInheritBefore</code> value) will apply the
   127      closest defined merge order.</p>
   128  
   129  </div>
   130  </div>
   131  <div class="bottomlang">
   132  <p><span>Available Languages: </span><a href="../en/mod/mod_substitute.html" title="English">&nbsp;en&nbsp;</a></p>
   133  </div><div class="top"><a href="#page-header"><img src="../images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&amp;A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>
   134  <script type="text/javascript"><!--//--><![CDATA[//><!--
   135  var comments_shortname = 'httpd';
   136  var comments_identifier = 'http://httpd.apache.org/docs/2.2/mod/mod_substitute.html';
   137  (function(w, d) {
   138      if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
   139          d.write('<div id="comments_thread"><\/div>');
   140          var s = d.createElement('script');
   141          s.type = 'text/javascript';
   142          s.async = true;
   143          s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
   144          (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
   145      }
   146      else { 
   147          d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
   148      }
   149  })(window, document);
   150  //--><!]]></script></div><div id="footer">
   151  <p class="apache">Copyright 2017 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>
   152  <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
   153  if (typeof(prettyPrint) !== 'undefined') {
   154      prettyPrint();
   155  }
   156  //--><!]]></script>
   157  </body></html>