Function actix_web::web::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"));