actix_web::web

Function redirect

source
pub fn redirect(
    from: impl Into<Cow<'static, str>>,
    to: impl Into<Cow<'static, str>>,
) -> Redirect
Expand description

Create a relative or absolute redirect.

See Redirect docs for usage details.

ยงExamples

use actix_web::{web, App};

let app = App::new()
    // the client will resolve this redirect to /api/to-path
    .service(web::redirect("/api/from-path", "to-path"));