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.
- Go to Domains → select the domain → Redirects tab.

- Click Add Rule to add a rule.
- 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).
- (Optional) Turn Enabled on/off for each rule — a separate toggle per rule, independent of the section's On/Off switch.
- 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
| Field | Meaning | Values | Default | Notes |
|---|---|---|---|---|
| Rule Name | Rule name | ≤128 characters, unique within the domain | — | Duplicate name → error 400 |
| Priority | Priority | Integer -1000..1000 | 0 | The 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/off | On | Off → the edge skips that rule (it is not deleted); only switching the section Off deletes all rules |
| Status | Redirect code | 301 / 302 / 307 / 308 | 301 | 301/308 = permanent (browsers cache them aggressively); 302/307 = temporary; 307/308 preserve the method+body. The interface allows only these 4 codes |
| Destination URL | Destination 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) |
| Conditions | AND conditions for the rule to match | ≥1, ≤20 conditions | — | Empty → 400 |
| › Field | Field to match against | url_path, url_query, request_method, hostname, user_agent, cookie, origin, via, ip_source | — | — |
| › Operator | Operator | equals, regex, starts_with, ends_with (+ ignore_case/not_ variants) | — | regex allows capture groups |
| › Values | Values 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_pathequals/promo-2024· Destination:https://example.com/promo - Result:
GET /promo-2024→ 301Location: https://example.com/promo. - Check:
curl -I https://example.com/promo-2024→ you see301+ the correctLocation.
Example 2 — Move an entire directory branch with regex (keeping the rest of the path).
- Status:
301· Condition:url_pathregex^/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→Locationcontains/news/abc.
Example 3 — Consolidate non-www traffic onto www (by hostname).
- Status:
308· Condition:hostnameequalsexample.com· Destination:https://www.example.com/ - Result: requests to the host
example.comare sent towww.(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
priorityfield before evaluating them — a lowerprioritynumber runs first. If 2 rules both match, the rule with the lowerprioritywins; evaluation stops at the first matching rule. Give specific rules a lowpriorityand 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
| Symptom | Common cause | Fix |
|---|---|---|
| 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 name | Use unique names |
| Save returns 400 "at least one match condition" | The rule has no conditions | Add at least 1 condition |
| A rule does not run even though it was saved | A rule with a lower priority (or the same priority but listed earlier) matched first, or the rule is disabled | Lower the priority of the rule that should take precedence; turn on Enabled |
| The query is lost after the redirect | The Destination already contains ? | Remove ? from the Destination so the edge appends the original query automatically |
FAQ
- How does
prioritywork? The edge sorts rules byprioritybefore evaluating them — lower numbers run first, and the first match wins. New rules default topriority= 0, so if every rule is 0, they run in list order. Give specific rules a lowprioritynumber. - 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
regexoperator with a(...)group in the pattern, then insert$1..$9into the Destination. - Why can't I use
http://? The edge only emits absolutehttps://destinations or same-origin paths, so the system rejectshttp://on save. Always usehttps://or a path/….