Forum Discussion
nathe
Aug 14, 2013Cirrocumulus
Here's my stab at this, cleaned it up with switch cmd. Not entirely sure if it's the best but here goes:
when HTTP_REQUEST { if { [string tolower [HTTP::host]] ends_with "oldsite.com" } { set uri [string tolower [HTTP::uri]] switch $uri { "/" { HTTP::respond 301 Location "https://landingpage.com" } "/teamsites/" { HTTP::respond 301 Location "https://newsite.com/sites" } } switch -glob $uri { "/teamsites/it/" - "/teamsites/finance/" - "/teamsites/hr/*" { if { [TCP::local_port] == 80 } { HTTP::respond 302 noserver Location "https://[HTTP::host][HTTP::uri]" } } else { HTTP::respond 302 noserver Location "https://newsite.com[HTTP::uri]" } } } }