iRule: multiple URI redirection

Hi..

I need to do the redirect for HTTPS traffic based on URI contains. I followed working iRule (two pools) and did modifications below but it’s giving an error please any help is highly appreciated.

Working iRule

when HTTP_REQUEST { if { [HTTP::uri] contains “prod” } { pool prod_pool } else { pool default_pool } }

Modified iRule but not working

when HTTP_REQUEST { if { [HTTP::uri] contains “prod” } { pool prod_pool } if { [HTTP::uri] contains “dev” } { pool dev_Pool } else { pool default_pool } }

when HTTP_REQUEST { 
    if { [HTTP::uri] contains "prod" } { 
        pool prod_pool 
    } elseif { [HTTP::uri] contains "dev" } { 
        pool dev_Pool 
    } else { 
        pool default_pool
    }
}

However, “contains” sounds a bit too broad to me.