Forum Discussion
Conditional redirect based on passed parameters...
Hello All,
I need help with creating a rule that would do the following...
If the http request is www.domain.com or domain.com then it needs redirected to www.redirect.domain\page
If the http request is www.domain.com\token¶meters then I need to let that pass un-altered.
Is such a rule possible?
3 Replies
- Andres_4712Historic F5 Account
Taking your goal description literally (redirect if URI does not containg strings), irule would be very simple:
when HTTP_REQUEST { if { [HTTP::uri] eq "/"}{ HTTP::redirect http://www.redirect.domain\page } }I would point that the real URL whould be:
http://www.redirect.domain/page - JRahm
Admin
That doesn't account for the specific domain, though, and I think the intent is that /page is whatever was sent to the original request as a uri. If that's the case, Phil, something like this should work:
when HTTP_REQUEST { if { [domain [HTTP::host] 2] eq "domain.com" } { HTTP::redirect "http://www.redirect-domain.com[HTTP::uri]" } } - Andres_4712Historic F5 Account
That could be true. Good point Jason.
Within the description the only difference in the requests was the URI:
Case a:
www.domain.com
then : redirect.
Case b:
www.domain.com\token¶meters
then "Forward".
So I based the decision for the redirect in URI. Phill has the last word :).
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