Apache HTTP Server Version 2.2
 
	This document refers to the 2.2 version of Apache httpd, which is no longer maintained. The active release is documented here. If you have not already upgraded, please follow this link for more information.
You may follow this link to go to the current version of this document.
| Description: | Perform search and replace operations on response bodies | 
|---|---|
| Status: | Extension | 
| Module Identifier: | substitute_module | 
| Source File: | mod_substitute.c | 
| Compatibility: | Available in Apache 2.2.7 and later | 
mod_substitute provides a mechanism to perform
				both regular expression and fixed string substitutions on
				response bodies.
| Description: | Pattern to filter the response content | 
|---|---|
| Syntax: | Substitute s/pattern/substitution/[infq] | 
| Context: | directory, .htaccess | 
| Override: | FileInfo | 
| Status: | Extension | 
| Module: | mod_substitute | 
The Substitute directive specifies a
				search and replace pattern to apply to the response body.
The meaning of the pattern can be modified by using any combination of these flags:
inn flag forces the pattern to be treated
					as a fixed string.ff flag causes mod_substitute to flatten the
					result of a substitution allowing for later substitutions to
					take place on the boundary of this one. This is the default.qq flag causes mod_substitute to not
					flatten the buckets after each substitution. This can
					result in much faster response and a decrease in memory
					utilization, but should only be used if there is no possibility
					that the result of one substitution will ever match a pattern
					or regex of a subsequent one.
						<Location />
						
							AddOutputFilterByType SUBSTITUTE text/html
							Substitute s/foo/bar/ni
						
						</Location>
					
If either the pattern or the substitution contain a slash character then an alternative delimiter should be used:
						<Location />
						
							AddOutputFilterByType SUBSTITUTE text/html
							Substitute "s|<BR */?>|<br />|i"
						
						</Location>
					
| Description: | Change the merge order of inherited patterns | 
|---|---|
| Syntax: | SubstituteInheritBefore on|off | 
| Default: | SubstituteInheritBefore off | 
| Context: | directory, .htaccess | 
| Override: | FileInfo | 
| Status: | Extension | 
| Module: | mod_substitute | 
| Compatibility: | Available in httpd 2.2.32 and later | 
Whether to apply the inherited Substitute
				patterns first (on), or after the ones of the current
				context (off).
				SubstituteInheritBefore is itself inherited,
				hence contexts that inherit it (those that don't specify their own
				SubstituteInheritBefore value) will apply the
				closest defined merge order.