Forum Discussion
Joe_Pipitone
Nimbostratus
Jun 02, 2010Unique redirect iRule help
We have an iRule that doesn't seem to be doing the job, and just ends up in a redirect loop. I'm pretty sure why, however I am not 100% sure how to get this working properly.
We have a website, lets say its http://events.oursite.com. When a user visits the homepage of this site, we want to redirect them to http://anothersite.com/events.
when a user goes to http://events.oursite.com/somedir/somepage.aspx, we want them to stay there, no redirection.
When I put the following iRule in place, a loop occurs. I am thinking this is happening because if they go to the homepage, the iRule is catching and redirecting them multiple times to http://events.oursite.com over and over again.
What am I missing here? Any help is appreciated.
when HTTP_REQUEST {
if { ([HTTP::host] eq "events.oursite.com") } {
switch -glob [HTTP::uri] {
"/" { HTTP::redirect "http://anothersite.com/events" }
default { HTTP::redirect "http://events.oursite.com[HTTP::uri]" }
}
}
}
1 Reply
- Joe_Pipitone
Nimbostratus
I figured this one out on my own, I had to use a default statement inside an if statementif {[HTTP::uri] eq "/" } { switch -glob [HTTP::uri] { "/" { HTTP::redirect "http://anothersite.com/events" } default { HTTP::redirect "http://events.oursite.com[HTTP::uri]" } } }
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