Zum Inhalt springen
Deutsch

mod_rewrite(4gx)

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

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

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

This component shares http.cfg. See http(8gx).

The filemap that specifies which URIs to handle is rewrite.txt, which is searched for in config_file_path. The usual location is /etc/gromox/rewrite.txt.

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. For safety, this should always be anchored with the beginning-of-line metacharacter (^; circumflex).

  • The fixed sequence "=>".

  • Replacement string. Captures can be spliced using \1, \2, etc. The sequence \0 splices the entire string (equivalent of Perl's $&). If a particular pattern has successfully matched, no other rewrite rules are processed.

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.

^/Microsoft-Server-ActiveSync(/\|$) => /sync/index.php
^/([a-z+])/([a-z]+).txt$ => /\2/\1.txt
  • config_file_path/rewrite.txt: Map specifying how to rewrite URIs

gromox(7), http(8gx)