How to add Trailing slash to all URL's with Redirect Rules?

Hi, My website is opening without a trailing slash. I want to add 301 redirect and redirect all such URL’s with trailing slash. How to do this?

You’d need to create one or more Redirect Rules to match the paths or the patterns that represent several paths, but paying attention that the rules do not redirect unintended files.

In any case the expression to the target redirect could be something like:

concat(http.request.uri.path, "/")

As for which patterns you’ll be matching, it depends on your website structure. For instance:

To redirect

/path-a

To

/path-a/

You could use the expression:

URI Path equals "/path-a"

But if you have several paths starting with:

/dir-a/path-a
/dir-a/path-b
etc.

You could use

URI Path starts with "/dir/"
AND
URI Path does not end with "/"