Skip to main content

Redirects — URL redirect rules

This section uses an On/Off switch in the top corner (turns the whole Redirects feature on/off for the domain) instead of the Create/Delete/Save buttons. Off = delete all of the domain's redirect rules.

Redirects let you define HTTP redirect rules (301/302/307/308) right at the edge, evaluated before the cache lookup, based on match conditions across many request fields (path, query, method, hostname, User-Agent, cookie, Origin, Via, IP). The first matching rule produces a redirect response with a Location header, and supports regex capture groups ($1..$9) inserted into the destination URL.

Use this when: migrating old URLs to new ones, consolidating www/non-www, or redirecting for campaigns. Example: you rename /promo-2024 to /promo — set up one 301 rule so both visitors and Google are sent to the new URL.

Before you start​

  • The domain has been added and points to VNIS.

How to configure​

This section uses an On/Off switch in the top corner: On = create and apply the redirect configuration (saved immediately); Off = delete all of the domain's redirect rules. The rules are shown even when Off — add/edit them first, then switch On.

  1. Go to Domains → select the domain → Redirects tab. Go to Domains → select the domain → Redirects tab
  2. Click Add Rule to add a rule.
  3. Set the Rule Name, choose the Status (301/302/307/308), enter the Destination URL, and add at least 1 Condition (choose Field / Operator / Values).
  4. (Optional) Turn Enabled on/off for each rule — a separate toggle per rule, independent of the section's On/Off switch.
  5. Turn on the On switch in the top corner of the section. For later changes, click Save (shown only when On and there are unsaved changes).

Configuration fields​

FieldMeaningValuesDefaultNotes
Rule NameRule name≤128 characters, unique within the domain—Duplicate name → error 400
PriorityPriorityInteger -1000..10000The edge sorts rules by priority before evaluating them; a lower priority number runs first, and the first match wins — see Order of evaluation
Enabled (per rule)Turns each rule on/off individually (independent of the section's On/Off switch)On/offOnOff → the edge skips that rule (it is not deleted); only switching the section Off deletes all rules
StatusRedirect code301 / 302 / 307 / 308301301/308 = permanent (browsers cache them aggressively); 302/307 = temporary; 307/308 preserve the method+body. The interface allows only these 4 codes
Destination URLDestination URL (Location header)Starts with https:// or a same-origin path (/path), ≤2048 characters, no whitespace/control characters—http://… and //… URLs are rejected on save (the interface blocks them, the API returns 400). May contain $1..$9 (not in the scheme part)
ConditionsAND conditions for the rule to match≥1, ≤20 conditions—Empty → 400
› FieldField to match againsturl_path, url_query, request_method, hostname, user_agent, cookie, origin, via, ip_source——
› OperatorOperatorequals, regex, starts_with, ends_with (+ ignore_case/not_ variants)—regex allows capture groups
› ValuesValues to match≥1, each value non-empty—Multiple values = match any (OR)

Limit: at most 100 rules per domain.

Configuration examples​

Rules are sorted by priority (lower numbers run first) and then evaluated in turn, stopping at the first matching rule. All conditions in a rule must match together (AND).

Example 1 — Permanently redirect an old page to a new page.

  • Status: 301 · Condition: url_path equals /promo-2024 · Destination: https://example.com/promo
  • Result: GET /promo-2024 → 301 Location: https://example.com/promo.
  • Check: curl -I https://example.com/promo-2024 → you see 301 + the correct Location.

Example 2 — Move an entire directory branch with regex (keeping the rest of the path).

  • Status: 301 · Condition: url_path regex ^/blog/(.*)$ · Destination: https://example.com/news/$1
  • Result: GET /blog/abc → Location: https://example.com/news/abc (capture group $1 = abc).
  • Check: curl -I https://example.com/blog/abc → Location contains /news/abc.

Example 3 — Consolidate non-www traffic onto www (by hostname).

  • Status: 308 · Condition: hostname equals example.com · Destination: https://www.example.com/
  • Result: requests to the host example.com are sent to www. (308 preserves the method). The original query is kept automatically (because the Destination contains no ?).
  • Check: curl -I -H "Host: example.com" https://.../page?a=1 → Location: https://www.example.com/page?a=1.

Keeping the query string: if the Destination has no ? and the request has a query, the edge automatically appends the original query. If the Destination already has ?..., it is kept as is and nothing is appended.

Order of evaluation​

  • The section's On/Off switch = whether the redirect configuration exists: Off = delete all rules; this is different from the per-rule Enabled toggle (which only temporarily turns one rule on/off, without deleting it).
  • The edge sorts rules by the priority field before evaluating them — a lower priority number runs first. If 2 rules both match, the rule with the lower priority wins; evaluation stops at the first matching rule. Give specific rules a low priority and general rules a higher number.

New redirect rules default to priority = 0. If every rule has priority = 0 (the same priority), they are evaluated in exactly the order of the list — which makes it easy to mistakenly believe that rules "run in list order". To make sure a rule runs first, give it a lower priority number.

A Destination starting with http:// (or //…) is rejected on save (400) — use an absolute https://… URL or a path (starting with /). A Destination without ? keeps the original query string; Status must be one of 301/302/307/308, otherwise you get 400.

  • Redirects run after Access Control and before the cache — a request that matches a rule never reaches the origin/cache.
  • The system always has open-redirect protection: a destination URL with //host, an unusual scheme (javascript:), or a host that does not match the template (when using captures) is skipped (no redirect).

Troubleshooting​

SymptomCommon causeFix
Cannot save / error "destination must start with https:// or a same-origin path"The Destination uses http://… or //…Change it to https://… or a path /…
Save returns 400 "must be 301, 302, 307, or 308"Another code was chosen (e.g. 303)Use only 301/302/307/308
Save returns 400 "duplicate rule name"2 rules have the same nameUse unique names
Save returns 400 "at least one match condition"The rule has no conditionsAdd at least 1 condition
A rule does not run even though it was savedA rule with a lower priority (or the same priority but listed earlier) matched first, or the rule is disabledLower the priority of the rule that should take precedence; turn on Enabled
The query is lost after the redirectThe Destination already contains ?Remove ? from the Destination so the edge appends the original query automatically

FAQ​

  • How does priority work? The edge sorts rules by priority before evaluating them — lower numbers run first, and the first match wins. New rules default to priority = 0, so if every rule is 0, they run in list order. Give specific rules a low priority number.
  • 301 or 302? 301/308 = permanent redirect (good for SEO when a URL has really changed); 302/307 = temporary.
  • How do I use regex captures? Use the regex operator with a (...) group in the pattern, then insert $1..$9 into the Destination.
  • Why can't I use http://? The edge only emits absolute https:// destinations or same-origin paths, so the system rejects http:// on save. Always use https:// or a path /….