Forum Discussion
Keeping only specific URI's from Redirecting
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]" } } } }
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com