| handler_redirect | R Documentation |
Creates an HTTP handler that returns a redirect response.
handler_redirect(path, location, status = 302L, prefix = FALSE)
path |
URI path to match (e.g., "/old-page"). |
location |
URL to redirect to. Can be relative (e.g., "/new-page") or absolute (e.g., "https://example.com/page"). |
status |
HTTP redirect status code. Must be one of:
|
prefix |
[default FALSE] Logical, if TRUE matches path as a prefix. |
A handler object for use with http_server().
# Permanent redirect
h1 <- handler_redirect("/old", "/new", status = 301L)
# Redirect bare path to trailing slash
h2 <- handler_redirect("/app", "/app/")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.