Forum Discussion
Troy_Atwood_942
Mar 08, 2011Nimbostratus
3 scenario 301 redirection problem
We are moving sections of our website to a new url structure and need to redirect only the sections that are moving.
Sounds like a job for IRules!
We have 3 scenarios that we need...
hooleylist
Mar 08, 2011Cirrostratus
This should all be possible within the same iRule. I would take a look at some of the native URI parsing commands to start with and avoid regexes if at all possible.
http://devcentral.f5.com/wiki/default.aspx/iRules/http__uri
http://devcentral.f5.com/wiki/default.aspx/iRules/http__path
http://devcentral.f5.com/wiki/default.aspx/iRules/uri
Here is one example we discussed recently:
http://devcentral.f5.com/Community/GroupDetails/tabid/1082223/asg/50/afv/topic/aft/1177132/aff/5/showtab/groupforums/Default.aspx
If you have a lot of URIs to all redirect to the same page (or generally take the same action), you could add them to a string datagroup and then use the class (v10) or matchclass (v9) commands to check the requested URI against the list. If you're app is case-insensitive, set the URI and the strings in the datagroup to lower case using 'string tolower "string"' before doing the class lookup.
http://devcentral.f5.com/wiki/default.aspx/iRules/class
http://devcentral.f5.com/wiki/default.aspx/iRules/matchclass
Keep in mind that the values for most HTTP:: commands are cached within the same event and event priority. So if you log the value, change it and then try to log it again, the logging won't show the change even though it's been made.
If you get stuck, reply here with what you've tried and what's not working.
Aaron
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