{= include("docs.util"); start_docs_page(docs.technical_manual.page_titles.rewriterules); =}
The Rewrite Rules File
$PRODUCT_NAME includes a feature, based on Apache's rewrite module (but much more limited), which lets you filter your log files based on a set of rules listed in a text file. You can use a rewrite rules file by adding a rewriting log filter to your Log Filters set, in the Log Filters tab of the Profile Options. Rewrite rules let you easily add and maintain a large number of translations in one easily-edited text file.
Each line of the rule file contains a different directive. At this time, only the RewriteRule directive is supported. The syntax of RewriteRule is:
RewriteRule regexp replacement [flags]regexp is a regular expression (see {=docs_chapter_link('regexp')=}). If the value matches this regular expression, the replacement occurs; otherwise, the rule does nothing. If regexp matches, the value of the field is replaced by replacement; otherwise, the rule does nothing. Variables (e.g. $1) in replacement are resolved by replacing them by the value of the corresponding parenthesized subexpression (for instance, if the field value is "/dir1/dir2/file.html" and the pattern is "^/dir1/dir2/(.*)$", then it will match, and the value $1 will be replaced with "file.html" wherever it appears in replacement). flags can be empty, or it can be "L"; "L" means to stop running the rules if the filter matches. Otherwise, $PRODUCT_NAME will continue running the rules in order until it reaches the end of the rules.
For instance, a rule which replaces "john" with "John Q. Public" would be:
RewriteRule ^john$ "John Q. Public" [L]Though $PRODUCT_NAME's feature is based on Apache's rewrite module, most of Apache's features are not supported. If you have a need for one of Apache's features that is not present in $PRODUCT_NAME, please email $SUPPORT_EMAIL and we will add it if possible.
{= end_docs_page() =}