Forum Discussion
Joe_Pipitone
Nimbostratus
Jan 26, 2011Stripping 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
Altostratus
Jan 26, 2011The string range statement grabs the range of characters from the 21st character to the last of the URI. So, it basically ignores the /directory1/directory2/ part and grabs everything after.
We should be able to get rid of the else statement. In the case where /directory1/directory2 doesn't exist, do you still want to get rid of the "www" if the user requested it?
This should cover the first part.
when HTTP_REQUEST {
if { [HTTP::uri] starts_with "/directory1/directory2" } {
HTTP::redirect "http://oursite.org[string range [HTTP::uri] 22 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