Forum Discussion
irule for http redirect for micropages
All,
I am new to irule, need help on writing irule for below scenario.
We have e-comm site http://xyz.com/ohio, http://xyz.com/Arizona, http://xyz.com/texas and we recently moved to new e-comm site and I want to redirect http://xyz.com/ohio to http://abc.com/ohio
I have to collect header information of the microsite and add the microsite to new website as http://abc.com/ohio
I had to do this all states in USA.
1 Reply
Maybe something like this?
when HTTP_REQUEST { set state [getfield [string tolower [HTTP::path]] "/" 2] if { [class match $state equals states] } { HTTP::respond 301 location "http://abc.com/$state" } }Create a string data grouplist with all the states (lowercase strings) to match them.
Or if ALL your request is http://xyz.com/[state], then you don't need the data group:
when HTTP_REQUEST { set state [getfield [string tolower [HTTP::path]] "/" 2] HTTP::respond 301 location "http://abc.com/$state" }Beware of multiple redirects if you have other iRule content executed afterwards.
Good luck!
/Patrik
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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