iTP Secure WebServer System Administrator's Guide (iTPWebSvr 5.1+)
Configuring the iTP Secure WebServer
iTP Secure WebServer System Administrator’s Guide—522659-001
7-37
Using Conditional Commands
Using Conditional Commands
You can use the Tcl if command to specify the conditional execution of commands in a
Region directive. (See Appendix E, Tool Command Language (Tcl) Basics, for details
about the Tcl language.) The
if statement has the following syntax:
if condition {
if-true
} else {
if-false
}
If condition is non-zero (indicating true), the if-true statement is executed;
otherwise, the if-false statement (in the else clause) is executed. (The else clause
is optional.)
For example, suppose you want to redirect requests from any host in the
widget.com
domain to /widget-welcome.html while not affecting requests from any other
domain. You can use the Tcl if statement with the Tcl HostMatch command, as
follows:
Region / {
if [HostMatch *.widget.com] {
Redirect /widget-welcome.html
}
}
In this example, the Region directive redirects home-page requests from
*.widget.com to a special home page. (The Tcl HostMatch command is discussed in
detail in Appendix A, Configuration Directives.)
Using Tcl Variables
You can use Tcl variables in Region directives to give commands certain information
about a request, such as time of day, the web client host name, or the HTTP header
information. Then the commands can use this information to modify the behavior of the
request.