Forum Discussion
Maskman_58643
Nimbostratus
Jan 14, 2010Redirect an uri without "/"
Hi,
How can create a rule that redirect an uri without anything after "/" ?
for example :
redirect a https like "https://software.tuto.com/toto" to "https://software.tuto.com"
redirect the uri without "toto" !
Thank you for your help !
Bye.
3 Replies
- Cspillane_18296
Nimbostratus
Hi Maskman,
have you tried just redirecting to "/"?
e.g.
==========
when HTTP_REQUEST {
switch [HTTP::uri] {
/someuri { HTTP::redirect / }
}
}
==========
I believe this would achieve the result you are looking for. - Maskman_58643
Nimbostratus
Thanks Cspillane for the answer, but I don't understand.
Why don't check the "starts_with" before redirect, like : if { [HTTP::uri] starts_with "/toto" } ?
I just want the url redirect to the same without "toto" !
Thanks.
Bye. - Cspillane_18296
Nimbostratus
Hello Maskman,
yes you can use 'starts with' and 'ends with' etc - exactly how you implement the rule is up to you.
so, for example:
=================
when HTTP_REQUEST {
switch [HTTP::uri] {
/toto { HTTP::redirect / }
}
}
=================
We're only modifying the uri here, so "/toto" becomes "/".
The host (i.e. "https://software.tuto.com") is not affected by the iRule.
So using the iRule above, a user accessing "https://software.tuto.com/toto" is redirected to "https://software.tuto.com/".
If i have understood your requirements correctly, this is exactly what you need!
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