Redirect

@Serializable
class Redirect(val from: String, val to: String)(source)

URL redirect mappings.

Specifying a mapping like "/legacy-name" to "/new-name" will cause the Kobweb server to issue a 301 redirect if the from path is visited.

The from path supports regexes, and capture groups can be substituted into the to path using $1, $2, etc. For example, a mapping like "/old/(^/*)" to "/new/$1" will redirect "/old/abc" to "/new/abc".

IMPORTANT: The user must remember to add a leading slash. Unfortunately, we cannot simply detect a missing slash ourselves because (.+)/old is a valid from value. If the user does not include a leading slash, then their from pattern will never match.

Constructors

Link copied to clipboard
constructor(from: String, to: String)

Properties

Link copied to clipboard
Link copied to clipboard
val to: String