Debian Codegraph @

www/src/content/reference/02-headers/12-HX-Redirect.md

raw symbols SCIP
1 ---
2 title: "HX-Redirect"
3 description: "Client-side redirect to a new URL"
4 ---
5
6 The `HX-Redirect` response header redirects to a new URL with a full page reload.
7
8 Use this when redirecting to non-htmx endpoints, or to pages with different `<head>` content or scripts that require a full browser load. For AJAX navigation that stays within your htmx application, use [`HX-Location`](/reference/headers/HX-Location) instead.
9
10 Response headers are not processed on 3xx response codes. Return a 2xx status when using this header.
11
12 ## Example
13
14 ```http
15 HX-Redirect: /dashboard
16 ```
17
18 ```python
19 return Response(
20 "Redirecting...",
21 headers={'HX-Redirect': '/dashboard'}
22 )
23 ```
24
25 See also: [`HX-Location`](/reference/headers/HX-Location)