pmaubo3_109863
Jul 20, 2012Nimbostratus
Using Class for uri and url redirects
We currently have a URL where they want a uri redirect which is fine. Also, the want to use a uri to invoke a URL redirect. The issue is, if we just keep adding single irules in, it gets ugly and is not effective. So I am working on a single irule that will
1. Take a uri to a page they want it to land on.
2. Take a uri has been used in the past and is not used anymore, so they want to have that uri redirect back to the main page.
Now... we want to use the Class so we can simply add keywords and also a class for redirects to whatever site they want.
Below, this irule works but I do not want to actually have the redirect URL in it but a variable to get the info from a class. Can anyone take a look and see if there is a better way?
Thanks in advance
universal_uri_url_irule
[Part 1]
when HTTP_REQUEST {
Class match if the vanity URI should be redirected back to www.default.com
if {[class match [string tolower [HTTP::uri]] equals vanity_redirect_root_www]}{
HTTP::redirect "https://www.default.com"
Class for this = keyword in this class determines that it will go to www.default.com
[Part 2]
}
Class match if the vanity URI should be redirectd to another site
if {[class match [string tolower [HTTP::uri]] equals vanity_redirect_diff_domain]}{
HTTP::redirect "https://diff.domain.com"
}
}
Once again. on Part 2 I do not want to list the url directly but grab it from a class