Forum Discussion
Joe_Pipitone
Jan 26, 2011Nimbostratus
Stripping part of URI and integrating with iRule
I have to perform the following: http://www.oursite.org/directory1/directory2/somepage.aspx needs to rewrite to http://oursite.org/somepage.aspx - essentially just stripping out directory1 and dir...
Chris_Miller
Jan 26, 2011Altostratus
Oh, and before I forget. You should use "string tolower" to convert your URI to lower case before checking it. Otherwise, someone accidentally capitalizing any characters in their request will keep the rule from executing properly.
when HTTP_REQUEST {
if { [string tolower[HTTP::uri]] starts_with "/directory1/directory2" } {
HTTP::redirect "http://oursite.org/[string range [HTTP::uri] 11 end ]"
log local0. "/directory1/directory2 found, redirected"
}
}
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