Forum Discussion
Arvind_Thevendr
Nimbostratus
Mar 06, 2014irule 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-c...
Mar 07, 2014
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
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