From Handler

    Issuing a HTTP redirect from POST.

    1. ctx.Redirect("/login", iris.StatusFound)
    2. })

    Globally

    Use the syntax we all love.

    1. import "github.com/kataras/iris/v12/middleware/rewrite"
    1. RedirectMatch:
    2. # Redirects /seo/* to /*
    3. - 301 /seo/(.*) /$1
    4. # Redirects /docs/v12* to /docs
    5. - 301 /docs/v12(.*) /docs
    6. # Redirects /old(.*) to /
    7. - 301 /old(.*) /
    8. # Redirects http or https://test.* to http or https://newtest.*
    9. - 301 ^(http|https)://test.(.*) $1://newtest.$2
    10. # without redirect. See /users route.
    11. # When Code is 0 then it does not redirect the request,
    12. # instead it changes the request URL
    13. # and leaves a route handle the request.
    14. - 0 /(.*).(json|xml) /$1?format=$2
    15. # Redirects root domain to www.
    16. # Creation of a www subdomain inside the Application is unnecessary,
    17. # all requests are handled by the root Application itself.

    The full code can be found at the .