hkr_36676
Mar 04, 2008Nimbostratus
Using "switch" instead of "if"
Hi
I have made this script to remove "ndk_webste" in links
on Google.
It uses a Data_Group "map_website", to make a 301 redirect.
when HTTP_REQUEST {
/ndk_website/npsportal/cmsdoc.nsf/WebDoc/ndkw73fh32
$website == /npsportal $index == /cmsdoc.nsf/WebDoc/ndkw73fh32
if { [HTTP::uri] contains "ndk_website"} {
regexp {/ndk_website/([^/]+)} [HTTP::uri] website
regexp {(?:/cms)([^?]+)} [HTTP::uri] index
set redirect_map [findclass $website $::map_website " "]
HTTP::respond 301 Location "http://$redirect_map$index"
}
}
I have read that it is easier for the box to use switch.
How would my script look like if I used "switch"?
/Hallur