Forum Discussion
Bob_10976
Nimbostratus
Apr 24, 2008Rewrite iRule to replace ISAPI rewrite
Let me first start off saying I'm very new to the F5 so sorry if my questions seem nebie'ish.
Our current environment we use an ISAPI Rewrite in IIS to redirect request to the correct locati...
Bob_10976
Nimbostratus
Jun 20, 2008A couple of examples from our rewrite rule is below, honestly I still don't completely understand it, my dev guy wrote these, I just put them in place, hope it helps a bit...
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] equals "/helpcenter/" } {
HTTP::uri "/helpcenter/Pages/default.aspx"
}
elseif { [string tolower [HTTP::uri]] equals "/helpcenter/livehelp.htm" } {
HTTP::uri "/Pages/livehelp.aspx"
}
elseif { [string tolower [HTTP::uri]] starts_with "/policy/privacy.htm" } {
HTTP::uri "/Pages/privacy.aspx"
}
elseif { [string tolower [HTTP::uri]] starts_with "/policy/security.htm" } {
HTTP::uri "/Pages/security.aspx"
}
}
Also is a few examples from our Redirect rule:
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] equals "www.mydomain.com" } {
HTTP::respond 301 Location http://mydomain.com[HTTP::uri]
}
elseif { ([string tolower [HTTP::uri]] equals "/default.htm") || ([string tolower [HTTP::uri]] equals "/default.html") } {
HTTP::redirect http://mydomain.com/
}
elseif { [string tolower [HTTP::uri]] starts_with "/newsroom" } {
HTTP::respond 301 Location http://test.mydomain.com/newsroom/[substr [HTTP::uri] 10 ]
}
elseif { [string tolower [HTTP::uri]] starts_with "/g2p" } {
HTTP::redirect http://test.mydomain.com/g2p/[substr [HTTP::uri] 5 ]
}
elseif { [string tolower [HTTP::uri]] starts_with "/eventcal" } {
HTTP::respond 301 Location http://test.mydomain.com/eventcal/[substr [HTTP::uri] 10 ]
Good luck..
Bob
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
