Redirect 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.

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.

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.

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!