Conditional request modifications can be organized in logical
branches, each branch being applied only if the request matches
certain condition. The Rewrite
section encloses a set of
request matching rules followed by one or more request modification
statements, which will be applied if the former match the request.
Optional Else
sub-section, which in turn contains request matching
rules and modification statements, will be tried if those rules don’t
match. Any number of Else
sub-sections is allowed, each one being
tried if the previous ones don’t match.
The example below illustrates this concept. This configuration snippet sets different paths depending on the file type and URL used:
Service Rewrite Header "Content-Type:[[:space:]]+image/.*" SetPath "/images%[path]" Else Match AND Host "example.org" Path "\\.[^.]+$" End SetPath "/static%[path]" Else Path "\\.[^.]+$" SetPath "/assets%[path]" End ... End