10-Jan-2022 03:36
Dear All
Can anyone suggest me the irule for an url redirection? I want to redirect from abc.com to abc.com/xyz.
Please suggest me if the LTM policy also solve the purpose.
Thanks in Advance
10-Jan-2022
07:31
- last edited on
24-Mar-2022
02:09
by
li-migration
Hello
Below iRule should fulfil your requirement.
when HTTP_REQUEST {
if { [HTTP::host] eq "abc.com" }
{
HTTP::redirect https://abc.com/xyz
}
}
Yes LTM policy will also solve your requirement. Attached snap shows the sample policy.
Hope it helps!
10-Jan-2022 08:31
Hi Mayur
I already tried with the Ltm policy, but site (https://abc.com/xyz)is not coming with the policy, but redirection is happening there. and without policy if I browse https://abc.com/xyz directly its coming.
I will check the irule, and let you know.
Many thanks for your valuable suggestion.
11-Jan-2022
03:17
- last edited on
21-Nov-2022
11:58
by
dcapiuser
Be careful with this code since any HTTP path would be redirected to /xyz/ , also the opening " { " bracket at line 3 needs to be moved in line 2 for proper syntax.
If you need to match only "/" path use the following code instead.
This will append /xyz/ without issuing a redirect -- based on your previous comment, I'm assuming the /xyz/ path is hosted within the same pool you use for load balancing ; a redirect will be required if this is not the case
when HTTP_REQUEST {
if {[HTTP::host] eq "abc.com" && [HTTP::path] eq "/"}{ HTTP::uri "/xyz/" }
}