# Redirects
Redirection instructs the client to go to a different URL.
#Using HttpResponse Builders
You can create redirects by setting the Location header and using a 3xx status code (usually 301 Permanent or 302/303 Temporary).
code_blocksrust
use actix_web::{get, HttpResponse, Responder};
use actix_web::http::header;
#[get("/old")]
async fn old_path() -> impl Responder {
HttpResponse::Found() // 302
.append_header((header::LOCATION, "/new"))
.finish()
}#Using web::Redirect
Actix Web provides a built-in helper for simple redirects.
code_blocksrust
use actix_web::web;
// in App config:
// .route("/old", web::get().to(|| async { web::Redirect::to("/new") }))