Redirects

Redirect Rules rewrite a request's URL before it goes out — a find/replace for traffic. Use them to point a request at a different host, swap a query parameter, or reroute a path during local development.

Two modes

  • Simple — a literal find/replace on the URL text. No regex knowledge needed.
  • Regex — a regular expression, with capture groups and backreferences, for anything a literal match can't express.

Switching between the two only applies instantly if your existing find text still makes sense in the new mode (a literal string that isn't valid regex, for example). Otherwise DevHeader holds the change as a draft so you can fix it before it's saved.

Live preview

As you type, the Redirects tab shows a live preview of what your rule will do to a sample URL:

  • In Simple mode, the preview uses your own find text, so what you see is exactly what will match.
  • In Regex mode, the preview uses a generic sample URL, since an arbitrary pattern can't be reverse-engineered into one. If your pattern doesn't match the sample, the preview just shows "not matched" — it doesn't mean your rule is broken, only that this particular sample doesn't happen to match it.

Creating a rule

  1. Open the Redirects tab.
  2. Add a rule, fill in Find and Replace, and pick a mode.
  3. Optionally narrow which requests it applies to — by resource type (scripts, XHR, images, etc.) or HTTP method — via the filters button.
  4. Click Save Changes.

Drag the grip (⋮⋮) at the start of a row to move it, or focus the grip and press the Up and Down arrow keys. Drag the line between the Match and Replace column headings to change their widths (double-click it to reset).

The enabled toggle, reordering and the filters modal apply immediately; editing Find/Replace text stays a local draft until you save.

Chrome matches redirects with its RE2 regex engine, which doesn't support lookaheads ((?!…)), lookbehinds ((?<=…)) or backreferences (\1). The popup asks Chrome before saving and shows the reason on the row if it can't use your pattern (in the JSON view, under the editor, naming the item). Each saved rule has a status dot, the same as on the Headers tab.

Scope

Like every rule type, a redirect only fires on domains you've scoped it to (or everywhere, if your domain list is empty) and only once you've granted the one-time permission — see Domains. Redirects also apply to full page navigations, not just background requests, so typing a URL or clicking a link can be redirected too.

See also