Hi!
You might want to try the syntax highlighting function. Otherwise your irules will be hard to interpret.
One thing that could be the issue with your original irule was that you set the case to lower and then match against capital letters (not sure if this was just an example gone bad though).
I might have tried to parse the directory instead of doing switch glob. Try this one?
when HTTP_REQUEST {
HSL::send $hsl "This is the HTTP URI [HTTP::uri]"
HSL::send $hsl "This is the HTTP Path [HTTP::path]"
set directory [lindex [split [string tolower [HTTP::uri]] "/"] 1]
switch $directory {
"dir1" {
set switches [string map {"/$directory/" "/"} [string tolower [HTTP::uri]]]
HTTP::redirect "http://dir1.domain.com/$switches"
}
"dir2" {
set switches [string map {"/$directory/" "/"} [string tolower [HTTP::uri]]]
HTTP::redirect "http://dir2.domain.com/$switches"
}
"dir3" {
set switches [string map {"/$directory/" "/"} [string tolower [HTTP::uri]]]
the switches will be everythi from the origional URI after the first directory
HTTP::redirect "http://dir3.domain.com/$switches"
}
"dir4" {
HTTP::redirect "http://dir4.domain.com/"
}
"dir5" {
HTTP::redirect "http://dir5.domain.com"
}
"dir6" {
HTTP::redirect "http://dir6.domain.com"
}
}
}
/Patrik