Query on redirection

Hello All,

I have the below URL redirection requirement and I’m not sure if this is possible or not.

https://abcd.maintenance.com needs to be redirected to https://www.maintenance.com

where

https://abcd.maintenance.com/management & https://abcd.maintenance.com/reports should not be effected after redirection.

Requesting your kind help on this using iRule or redirect policy, thanks in advance.

-Cyril

Based on your example, are you asking that only the root uri “/” be redirect, and not “/management”, or are you asking that the URI just not be manipulated?

Certainly. You can access the HTTP::host and HTTP::uri variables and evaluate them separately.

I’d suggest using the Policy for readability, but the iRule would look like (untested):

when HTTP_REQUEST {
    if { [HTTP::host] == "abcd.maintenance.com" and ([HTTP::uri] == "/" or [HTTP::uri] == "") } {
        redirect "https://www.maintenance.com/"
    }
}

Hi Greg, Thanks for your swift response. If I access the domain alone “https://abcd.maintenance.com” it should be redirected to https://www.maintenance.com. But the above redirection should not impact the below URLs when accessed. https://abcd.maintenance.com/management & https://abcd.maintenance.com/reports should not be effected after redirection.