Forum Discussion
ervinc_27883
Nimbostratus
Sep 24, 2014multiple urls to single url
I want to redirect users to a single url (http://a.b.com/a/error.htm) if they came from (http://a.b.com/a/a.aspx?a=1 or http://a.b.com/a/h.aspx?a=f or http://a.b.com/b/4.aspx?a=3)
any help will ...
Lee_Payne_53457
Cirrostratus
Sep 24, 2014I would use a switch statement based on the variable you're passing in, like this:
switch [URI::query [HTTP::uri] "a"] { 1 { HTTP::redirect http://a.b.com/a/error.htm } f { HTTP::redirect http://a.b.com/a/error.htm } 3 { HTTP::redirect http://a.b.com/a/error.htm } }
mainly for the flexibility of redirecting elsewhere in future, but you could use an if statement containing all options, a datagroup containing all elements you want to redirect on and I'm sure a few other options.
ervinc_27883
Nimbostratus
Sep 24, 2014I'm new to the irule game, how would you code this? will this work?
when HTTP_REQUEST {
switch [URI::query [HTTP::uri] = "http://a.b.com/a/a.aspx?a=1" or http://a.b.com/h/h.aspx?g=5 or http://a.b.com/h/h.aspx?g=10 or http://a.b.com/f/u.aspx?g=8 ]
{ HTTP::redirect http://a.b.com/a/error.htm }
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects