I apologize, but beyond the .asp to .aspx part, it’s not entirely clear how else you want to redirect. However, assuming, I’m assuming you want the following:
if host == 123.abc.com, then
if Request Target Path ends_with .asp or .aspx, then
redirect to www.abc.com[path][query-params], with .asp changed to .aspx
else redirect to knowledge.cibc.com[path][query-params]
else
do not redirect
Adjust the following as needed for your actual requirements:
Notice that I cut your default branch, which made a pool call. If the pool assigned the Virtual Server is already /PROD/po_abc there is no need to explicitly identify the pool here. If the rule doesn’t change the pool selection, then the pool assigned to the Virtual Server will automatically be used.
hi Vernon, thanks for your reply. however when you are doing switch command, you cannot use “.asp" and ".aspx” as criteria to determine the action because .asp is same as part of aspx, so if some incoming traffic with http header uri including /xxx.aspx, it will be replaced as /xxxx.aspxx by your irule. that’s also the problem I had before.
If $x is the value “foot”, none of the cases would match. If, instead, $x is “foo”, only the last case would match.
The -glob flag to switch changes the matching style to “glob”. With this style, any instance of an asterisk (*) matches zero or more characters, a question-mark (?) matches exactly (any) one character, and characters in square-braces ([…]) form a character class (e.g., “[adgk]” would match a single character if and only if that character is a, d, g or k).
Case 1 will match if and only if $x is exactly the string “foo”. Case 2 will match if $x ends with the string “foo”. Case 3 will match if $x starts with the string “foo”. Case 4 will match if $x contains the string “foo”.
The original was missing a closing brace for the switch. I have updated my original post to include the missing brace, and just tested it. It parses correctly now.