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
conditional statements 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 conditional
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