Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral

Filter by:
  • Solution
  • Technology
Answers

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

0
Rate this Question
Comments on this Question
Comment made 26-Apr-2016 by Greg Labelle 242
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?
0
Comment made 26-Apr-2016 by Cyril 66
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.
0

Answers to this Question

placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

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/"
    }
}
2
Comments on this Answer
Comment made 26-Apr-2016 by Cyril 66
Thanks Theo. :) I will test the above iRule.
1