---
title: Redirects
description: Redirect one hostname to another at the edge.
order: 2
---

A domain attached to your project can either serve your application directly or **redirect** to another hostname. Redirects happen at Atlasflow's edge, before traffic reaches your container.

## When to use a redirect

The most common use is consolidating `www` and apex domains so users always land on one canonical hostname, for example redirecting `www.example.com` to `example.com`.

## Configure a redirect

1. Add the domain you want to redirect (for example `www.example.com`) and verify it. See [Custom domains](/docs/networking/custom-domains.md).
2. In the domain settings, set it to redirect to a target hostname.
3. Choose a redirect status code.

## Supported status codes

| Code | Meaning            | Use when                                        |
| ---- | ------------------ | ----------------------------------------------- |
| 301  | Moved Permanently  | The redirect is permanent and should be cached. |
| 302  | Found              | A temporary redirect.                           |
| 307  | Temporary Redirect | Temporary, preserving the request method.       |
| 308  | Permanent Redirect | Permanent, preserving the request method.       |

For canonical domain consolidation, **301** or **308** is usually the right choice.

## How it works

A redirecting domain doesn't route to your container at all. Atlasflow responds at the edge with the chosen status code and the target location, so your application never sees the request.

## Next steps

- [Custom domains](/docs/networking/custom-domains.md): add and verify the domain first.
- [DNS configuration](/docs/networking/dns-configuration.md): the records the redirect domain needs.