mod_rewrite

Name

mod_rewrite — http(8gx) processing plugin for altering HTTP request URIs before processing

Description

mod_rewrite can alter request URIs. It runs before any of the other built-in or HPM processing plugins.

Config file directives

This (built-in) plugin shares http.cfg. See http(8gx).

Rewrite map

The filemap that specifies which URIs to handle is rewrite.txt, which is searched for in config_file_path.

Each line in this file consists of 3 columns separated by whitespace:

  • A POSIX Basic Regular Expression (cf. regcomp(3)) for matching the original URI.

  • The fixed sequence “=>”.

  • Replacement string. Captures can be spliced using \1, \2, .. up to a maximum of \9. The sequence \0 splices the entire string (equivalent of Perl’s $&).

If the file has no lines, no paths will be rewritten. If the file is absent however, a set of default entries will be used.

Default rules

/autodiscover/autodiscover.xml => \0/ews/autodiscover.php
/EWS/Exchange.asmx => \0/ews/exchange.php
/OAB/oab.xml => \0/ews/oab.php
\(/Microsoft-Server-ActiveSync\) => \1/grammm-sync/index.php
\(/.well-known/autoconfig/mail/config-v1.1.xml\) => \1/well-known/autoconfig-mail.php

Files

  • config_file_path/rewrite.txt: Rewrite map specifying which paths this plugin shall handle.

See also

gromox(7), http(8gx)