CodeShare
Have some code. Share some code.
cancel
Showing results for 
Search instead for 
Did you mean: 
Custom Alert Banner
P_K
Altostratus
Altostratus

Problem this snippet solves:

When there is a Http request, this iRule looks for Uri starting with specified uri and redirects to different Host+Uri. If it does not match any uri, traffic should be dropped. Example: Uri starting with /a/1/anything/ should be redirected to www.whatever.com/a1/anything.

Code :

when HTTP_REQUEST { 
switch -glob [string tolower [HTTP::uri]] {
 "/a/1*" {
   HTTP::redirect "http://[HTTP::host]/a1*"
 }
 "/b/2*" {
 HTTP::redirect "http://[HTTP::host]/b2*"
 }
 "/c/3*" {
 HTTP::redirect "http://[HTTP::host]/c3*"
 }
 default { }
 }
}

Tested this on version:

11.5
Comments
P_K
Altostratus
Altostratus

Apologies, I Posted this as a intention for someone to take a look and correct it.

 

Version history
Last update:
‎09-Nov-2016 11:31
Updated by:
Altostratus
Contributors