Forum Discussion
uri redirects
Can anyone help me complement the irule below to redirect any url not mentioned here to a specific domain ?
For example, if user goes to http://mydomain1.org/page1 , it should send him to http://mydomain2.org/page/page1. Any other variation should just send him to the home page, for example; http://mydomain1.org/xyx should redirect to http://mydomain2.org.
when HTTP_REQUEST {
switch [string tolower [HTTP::uri]] {
"/page1.html" { HTTP::redirect "http://mydomain2.org/page/page1.html" } }
End of URI pattern case switch
}
End of rule
3 Replies
- Eric_St__John
Employee
You can utilize the default action.
switch [string tolower [HTTP::uri]] { "/page1.html" { HTTP::redirect "http://mydomain2.org/page/page1.html"} default { HTTP::redirect "http://mydomain.org" } }Regards, Eric
- Kevin_Stewart
Employee
Try this:
when HTTP_REQUEST { if { [string tolower [HTTP::uri]] equals "/page1.html" } { HTTP::redirect "http://mydomain2.org/page/page1.html" } else { HTTP::redirect "http://mydomain2.org" } }Or
when HTTP_REQUEST { switch [string tolower [HTTP::uri]] { "/page1.html" { HTTP::redirect "http://mydomain2.org/page/page1.html" } default { HTTP::redirect "http://mydomain2.org" } } } - Diego_23471
Nimbostratus
This worked beautifully. Thanks a lot for your quick response.
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