Forum Discussion
URI Rewrite
Requests coming to:
http://connect.company.com or http://connect.company.com/ or http://connect.company.com/inspiration or http://connect.company.com/inspiration/ should all be rewritten to:
http://connect.company.com/inspiration/default.aspx
For http://connect.company.com/creative or http://connect.company.com/creative/ to http://connect.company.com/creative/default.aspx
For http://connect.company.com/intelligence or http://connect.company.com/intelligence/ to http://connect.grey.com/intelligence/default.aspx
For http://connect.company.com/talent or http://connect.company.com/talent/ to http://connect.company.com/talent/default.aspx
For http://connect.company.com/communities or http://connect.company.com/communities to http://connect.company.com/communities/default.aspx
The irule I have is the following:
when HTTP_REQUEST {
if {([HTTP::uri] equals "/") or ([HTTP::uri] equals "/inspiration" ) or ([HTTP::uri] equals "/inspiration/")} {
HTTP::uri "/inspiration/default.aspx"
}
elseif {([HTTP::uri] equals "/creative") or ([HTTP::uri] equals "/creative" )} {
HTTP::uri "/crative/default.aspx"
}
elseif {([HTTP::uri] equals "/intelligence") or ([HTTP::uri] equals "/intelligence/")} {
HTTP::uri "/intelligence/default.aspx"
}
elseif {([HTTP::uri] equals "/talent") or ([HTTP::uri] equals "/talent/")} {
HTTP::uri "/talent/default.aspx"
}
elseif {([HTTP::uri] equals "/communities") or ([HTTP::uri] equals "/communities/")} {
HTTP::uri "/communities/default.aspx"
}
}
From your perspective, will this do the trick? the reason i am asking is because the iRules statistics dont show much traffic ... not sure if the " elseif " statement will break anything.
2 Replies
- nitass
Employee
it looks fine to me. by the way, don't you want to use switch instead of if/elseif?
e.g.when HTTP_REQUEST { switch [string tolower [HTTP::uri]] { "/" - "/inspiration" - "/inspiration/" { HTTP::uri "/inspiration/default.aspx" } "/creative" - "/creative/" { HTTP::uri "/crative/default.aspx" } "/intelligence" - "/intelligence/" { HTTP::uri "/intelligence/default.aspx" } "/talent" - "/talent/" { HTTP::uri "/talent/default.aspx" } "/communities" - "/communities/" { HTTP::uri "/communities/default.aspx" } } } - Francisco_Arach
Nimbostratus
Thanks for the quick response!
I am kinda new to iRules, did not know abou this switch command.. Will look into it..
thanks..
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