Forum Discussion
iRule assistance for subfolder redirect
- Jan 14, 2022
Hello,
in this attempt I'm using the getfield command to split URI by "/oldsubfolder/" string, so that first "oldsubfolder" match would be field 1 and the rest of your URI will be field 2.
I'm replacing /oldsubfoler/ with new path manually and then appending the rest of your uri using field 2 syntax.
when HTTP_REQUEST { if { [HTTP::uri] contains "/oldsubfolder/"} { HTTP::redirect https://[HTTP::host]/newsubfolder/[getfield [HTTP::path] "/oldsubfolder/" 2] } }
I haven't had the chance to test this in a lab, please do before installing.
Hello,
in this attempt I'm using the getfield command to split URI by "/oldsubfolder/" string, so that first "oldsubfolder" match would be field 1 and the rest of your URI will be field 2.
I'm replacing /oldsubfoler/ with new path manually and then appending the rest of your uri using field 2 syntax.
when HTTP_REQUEST {
if { [HTTP::uri] contains "/oldsubfolder/"} {
HTTP::redirect https://[HTTP::host]/newsubfolder/[getfield [HTTP::path] "/oldsubfolder/" 2]
}
}
I haven't had the chance to test this in a lab, please do before installing.
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