Forum Discussion
ibrahim_37929
Nimbostratus
Jun 14, 2016redirect i rule
Hi i want to redirect a lot of address like this format.
if http request comes with a.abc.com i want to redirect abc.com/a, b.abc.com ---> abc.com/b how can i do this with an i rule?
thanks for your help
5 Replies
- Vijay_E
Cirrus
Explore the option of "substr" & "string split" in IRule
- Amanpreet_Singh
Cirrostratus
Or you can use 2 data-groups and define use expressions to achieve your requirement with iRULE.
- ibrahim_37929
Nimbostratus
i did not use data group because i have to write 80 address to Data group list.
- Vijay_E
Cirrus
when HTTP_REQUEST { set URI [lindex [split [HTTP::host] "." ] 0] HTTP::respond 301 Location https://[substr [HTTP::host] 2 ".com"].com/$URI }You should be able to make the above more efficient and workable.
Hi,
You can use the below example. It's a single line irule :
when HTTP_REQUEST { HTTP::respond 301 Location "https://[getfield [HTTP::host] "." 2][getfield [HTTP::host] "." 3]/[getfield [HTTP::host] "." 1]" }
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects