> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.divert.ly/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.divert.ly/_mcp/server.

# How Divertly Works

> What happens when someone visits a Divertly link: route matching, target selection, fallback, and metrics.

Divertly sits between a link and its destination. When someone visits a link on one of your domains, here's what happens:

1. Divertly matches the request's domain and path to one of your [routes](/docs/concepts/routes).
2. The route's targeting strategy decides which [target](/docs/concepts/targets) should handle this particular request — for example, splitting traffic by weight, or checking the visitor's country.
3. The visitor is sent to that target's URL.
4. If no target matches, the route's fallback either returns an error or resolves to a default target.
5. The request is counted toward that domain's, route's, and target's [metrics](/docs/concepts/metrics).

Because the targeting strategy runs on every request, changing it — or a target's weight, or whether a target is enabled — takes effect immediately, without publishing anything or waiting for a deploy. That's what makes a route useful for gradually shifting traffic to a new destination or rolling back a change: you're editing the same route the whole time, not swapping links.

For how these pieces relate to each other and to your organization, see [Resource Hierarchy](/docs/concepts/resource-hierarchy).