Forum Discussion
Subfolder Redirect
- Mar 24, 2022
Hi 506ADA ,
Yes you can achive your requirement using iRule as well as LTM policy. One of the sample iRule is given below.
Given iRule is sample written looking at your requirement. Based on your different use cases, you may need to customize it more.
when HTTP_REQUEST { if {([HTTP::host] equals "mainpage.com") && ([HTTP::uri] contains "secondary")} { HTTP::redirect "https://mainserver.ad.blah.blah.com[HTTP::uri]" } elseif {([HTTP::host] equals "mainpage.com") && ([HTTP::uri] contains "main")} { pool Default-Pool-Name } }
NOTE - Normally when none of the case is matched (in iRule and/or LTM policy), F5 vServer forwards request to default pool attached on the vServer.
I have also attached one sample LTM policy for your second use case of redirection. You can also customize under LTM policy as per your wish/use case.
Hope it helps!
Hi 506ADA ,
Yes you can achive your requirement using iRule as well as LTM policy. One of the sample iRule is given below.
Given iRule is sample written looking at your requirement. Based on your different use cases, you may need to customize it more.
when HTTP_REQUEST {
if {([HTTP::host] equals "mainpage.com") && ([HTTP::uri] contains "secondary")} {
HTTP::redirect "https://mainserver.ad.blah.blah.com[HTTP::uri]"
} elseif {([HTTP::host] equals "mainpage.com") && ([HTTP::uri] contains "main")} {
pool Default-Pool-Name
}
}
NOTE - Normally when none of the case is matched (in iRule and/or LTM policy), F5 vServer forwards request to default pool attached on the vServer.
I have also attached one sample LTM policy for your second use case of redirection. You can also customize under LTM policy as per your wish/use case.
Hope it helps!
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com