Forum Discussion
Wil_Schultz_101
Feb 29, 2012Nimbostratus
So to keep it dynamic, you could grab the host header on HTTP_RESPONSE, and use that variable later on down the line.
when HTTP_REQUEST {
set host [string tolower [HTTP::host]]
set path [string tolower [HTTP::path]]
}
when HTTP_RESPONSE {
switch [HTTP::status] {
"404" {
switch -glob $path {
"/agency1*" {
HTTP::respond 301 \
"Location" "http://$host/agency1/moved.html" \
"Server" "$host"
}
"/agency2*" {
HTTP::respond 301 \
"Location" "http://$host/agency2/moved.html" \
"Server" "$host"
}
}
}
}
}