Announcing our new API documentation!
Check it out here

Path-based redirects: matching, forwarding, and status codes

Configure multiple path rules on a redirect, pick 301 vs 302 vs 307, and control path and query-parameter forwarding.

On this page:

Overview

A SiteDetour redirect isn't limited to a single target — each redirect holds a table of path rules. Each rule has its own target URL, redirect status code, and forwarding options. This article covers how the rules are evaluated and how to pick the right options.

Path matching

SiteDetour supports two match operators per rule:

  • Exact Match — the incoming request path must equal the rule's path character-for-character.
  • Starts With — the incoming request path must begin with the rule's path (useful for section-level redirects like /blog).

For each request, SiteDetour walks every rule and picks the longest match. A rule for /blog/2024 wins over a rule for /blog. If no rule matches, the Default Base Path (the first row, at /) is used.

Query strings are not part of the path match. A request for /foo?x=1 matches the same rule as /foo. To branch on query parameters, create a personalization audience with a Request Query Parameters rule.

For a worked example, see Redirect Path Selection Algorithm.

Forwarding options

Each path rule has two forwarding toggles:

  • Request Path — when on, the portion of the request path beyond the rule's match is appended to the target URL. Example: rule /blog → https://newsite.com/articles with forwarding on. Request for /blog/my-post redirects to https://newsite.com/articles/my-post. Useful when migrating a whole section 1:1.
  • Query Parameters — when on, the incoming query string is preserved on the Location header. Example: /promo?utm_source=twitter forwards ?utm_source=twitter to the target. Leave on if downstream analytics rely on UTMs.

Status codes

Three common redirect status codes, each with distinct semantics:

301 Permanent Redirect

Tells browsers and search engines the move is permanent. Browsers cache 301s aggressively — often until cache flush or private-mode retest. Search engines transfer link equity to the target. Use for permanent URL migrations.

302 Found (Temporary)

Signals a temporary redirect. Browsers don't cache as aggressively; search engines don't transfer link equity. Use for temporary routing (campaigns, maintenance, A/B tests).

307 Temporary Redirect

Like 302, but preserves the original HTTP method. A POST to /submit that 302s redirects as GET (losing the body); a 307 keeps it a POST. Use when the redirect target must accept the same request body and method.

Common patterns

  • Whole-site move: single rule on /, 301, Request Path + Query Parameters both on.
  • Section migration: add a Starts With rule on /old-section → new URL, 301, Request Path on. Default rule 301s to the new homepage.
  • Campaign redirect: rule on /promo, 302, Query Parameters on (to preserve UTMs), Request Path off.
  • API endpoint migration: rule on /api, 307, Request Path + Query Parameters on.

Next steps