Forum Discussion

Ts67p18's avatar
Ts67p18
Icon for Nimbostratus rankNimbostratus
Dec 09, 2020

Request Redirect

i need to redirect the following: 

https://abc.org/prod/items/ebb81b9e-0e6f-4bd8-af22-bf865212e2cd/1/

to

 https://cde.edu/ware/lesson/ebb81b9e-0e6f-4bd8-af22-bf865212e2cd/1/

there will be many requests containing different content after "/items/" that will need to be redirected to the new site and i am hoping to do this with one iRule.

is there a way to strip out the "ebb81b9e-0e6f-4bd8-af22-bf865212e2cd/1/" and add it to the new URL?

 

  • Hi Ts67p18,

    when HTTP_REQUEST {
    	if { [string tolower [HTTP::uri]] starts_with "/prod/items/" } {
    		HTTP::redirect "https://cde.edu/ware/lesson[string map -nocase {/prod/items/ /} [HTTP::uri]]"
    		return
    	}
    }