Forum Discussion
Redirect iRule
Hello all,
I have a simple iRule that redirects to another URL:
when HTTP_REQUEST {
HTTP::redirect "http://host.DomainName.com/uri1[HTTP::uri]"
}
problem that I am facing is that there are time when users actually add the /uri1, and then the iRule adds another one, which is a page cannot be displayed.
is there to make the iRule to add /uri only if it's not already there?
thanks in advance MJ
3 Replies
- janholtz
Altostratus
when HTTP_REQUEST { if { [ string tolower [HTTP::uri]] starts_with "/uri1" } { return } else { HTTP::redirect "http://host.DomainName.com/uri1[HTTP::uri]" } } - janholtz
Altostratus
Blecchh, I hate using negatives in an irule, try this:
when HTTP_REQUEST { if { ! [ string tolower [HTTP::uri]] starts_with "/uri1" } { HTTP::redirect "/uri1[HTTP::uri]" } } No dice.
I think my first post is a bit confusing and I apologize for that. so the iRule is this:
when HTTP_REQUEST {
HTTP::redirect "http://host.DomainName.com/uri1[HTTP::uri]" }
The iRule in its current state redirects fine, but the only problem is the with the uri where it gets doubled if it's already there, so what needs to happen is that the iRule needs to check if there's any uri it would strip it before it redirects to the final url/uri.
I hope making sense and not muddying this even further :)
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
